whateveragain
Programmer
Can anyone please tell me how to write code to check if a dynamic table exists? The code below only works if table exists otherwise I get error. @preseldma is a dynamic table.
if exists(select * from dbo.sysobjects where id = object_id(N'[dbo].[@preseldma]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
print 'table exists'
END
if exists(select * from dbo.sysobjects where id = object_id(N'[dbo].[@preseldma]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
BEGIN
print 'table exists'
END