Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Keshaba
Yak Posting Veteran
52 Posts |
Posted - 2008-12-29 : 07:09:24
|
I am using Sql server 2005 Express As Back end.How shall I write a query wheather a Table name EmployeeMaster in the database name MediaSys Exist or not.Keshab |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-12-29 : 07:22:55
|
quote: Originally posted by Keshaba I am using Sql server 2005 Express As Back end.How shall I write a query wheather a Table name EmployeeMaster in the database name MediaSys Exist or not.Keshab
if exists(select 1 from MediaSys..sysobjects where name ='EmployeeMaster')print 'exists'elseprint 'doesnt exist' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-29 : 12:21:23
|
or use thisIF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='EmployeeMaster' AND TABLE_TYPE='BASE TABLE')PRINT 'TABLE EXISTS'ELSE print 'TABLE DOESNT EXIST' |
|
|
|
|
|