Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function To Test For Table Doesn't Work
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01328338
Message ID:
01328490
Vues:
9
Hi Kevin,

The prefix 'temdb..' is only needed for object_id(). The DROP TABLE does not need it.


>
>It's working. The table is being dropped, however the message
>"Database name 'tempdb' ignored, referencing object in tempdb"
>appears in the results pane each time I run it.
>
>
>
>
>>You have to prefix a temp table with 'temdb..' as I shown in my original post. Try this one
>>
>>ALTER FUNCTION dbo.fnTableExists
>>	(@sTableName VARCHAR(50))
>>
>>RETURNS TinyInt
>>AS
>>
>>BEGIN
>>	IF @sTableName LIKE '#%'
>>		SET @sTableName = 'tempdb..' + @sTableName
>>
>>	RETURN CASE WHEN object_id(@sTableName) IS NOT NULL THEN 1 ELSE 0 END
>>
>>END
>>
>>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform