Sujata-334280
Newbie
Points: 1
More actions
June 2, 2006 at 5:47 am
#169727
I want to check if a table exists in a database. I tried to use
SELECT name FROM sysobjects WHERE xtype = āUā; but this gives listing for the current database. I want a query that will go to any specified database and check the table existence.
sree-226516
SSCrazy
Points: 2590
June 2, 2006 at 7:55 am
#641429
Try following query:
sp_MSforeachdb " select '?' as dbname,name from ?.dbo.sysobjects where xtype='U' and name='Table_name' "
Thanks,
SR
Thanks,SR
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply