SQL: Does the object exist?
If you need to check if an object exists in the database, rather than querying an obscure system table, you can use the OBJECT_ID function.
If you want to verify that the table FooBar exists in the YadiYada database, simply write the following IF statement:
IF OBJECT_ID('YadiYada..FooBar') IS NOT NULL BEGIN --FooBar exists so you can use it here --... END
0 Comments:
Post a Comment
<< Home