dbTalk Databases Forums  

How to Identify table???

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss How to Identify table??? in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #41  
Old   
Tibor Karaszi
 
Posts: n/a

Default Re: How to Identify table??? - 04-07-2008 , 02:07 PM






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/



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.