I tend to use OBJECT_ID, mostly because it is fewer letters and condenses fine on the same line.
IMO, makes my scripts a bit easier to read compared to a longer string for this.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"ms" <http://www.mskbfiles.com/> wrote
Quote:
Sometimes I create table "X" in my database, I meed someting to know if I have table "X" already
created, can you help me with that???
Or, you can use metadata function OBJECT_ID():
IF OBJECT_ID('dbo.X', 'U') IS NULL
CREATE TABLE dbo.X
--
KB
http://www.mskbfiles.com/ |