I'm trying to check if a certain table exists in a given database on a SQL 2005 Server.
I've tried numerous times without any result.
can anyone point me in the right direction?
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TableName]') AND type in (N'U'))
This was generated when i create a drop script for table.
|||the answer is so easy that i feel emberrased that i asked it.
Thanks for the support boban
|||Don't feel embarrased -I was googling for the answer and found it in this thread.M@.
|||
when I try to use the script code it gives me an error that sys.objects doesnt exist am I missing something here?
|||How about just 'select * from sys.objects where name = 'tablename' and type_desc = 'USER_TABLE'
sql
No comments:
Post a Comment