Can someone please help me w/ this syntax as I'm stumped:
DECLARE @mytable varchar(1000)
DECLARE @sqlCheck nvarchar(1000)
SET @mytable = 'tmp' + CAST(@@spid AS varchar(3))
SET @sqlCheck = 'if exists (select * from sysobjects where id = object_id(N'+ @mytable +') and OBJECTPROPERTY(id, IsUserTable) = 1) DROP TABLE '+@mytable+'
EXEC (@sqlCheck)
Any help would be greatly appreciated
Thanks.
DECLARE @mytable varchar(1000)
DECLARE @sqlCheck nvarchar(1000)
SET @mytable = 'tmp' + CAST(@@spid AS varchar(3))
SET @sqlCheck = 'if exists (select * from sysobjects where id = object_id(N'+ @mytable +') and OBJECTPROPERTY(id, IsUserTable) = 1) DROP TABLE '+@mytable+'
EXEC (@sqlCheck)
Any help would be greatly appreciated
Thanks.