How can I use the following Query using Dynamic Sql.The purpose of using Dynamic SQL is the table is on another server.
Generally when I use Dynamic SQL against select query I use
EXEC('SELECT * FROM '+@SERVERNAME+' .'+@LOCALDBNAME +'.DBO.'+'ÇUSTO MERS')
Here goes my Query
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MyTable]') and OBJECTPROPERTY( id, N'IsUserTable') = 1)
drop table [dbo].[MyTable]
GO
Generally when I use Dynamic SQL against select query I use
EXEC('SELECT * FROM '+@SERVERNAME+' .'+@LOCALDBNAME +'.DBO.'+'ÇUSTO MERS')
Here goes my Query
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MyTable]') and OBJECTPROPERTY( id, N'IsUserTable') = 1)
drop table [dbo].[MyTable]
GO
Comment