To check if a database exists:
if db_id('MyDatabase') is null
select 'false'
else
select 'true'
To check if a temporary table exist, use the following code. You need to search for them in tempdb because that's where all temporary tables are stored.
if object_id('tempdb..#temp', 'U') is not null
drop table #temp
GO
Thursday, August 31, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment