Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

linked server delete openquery

DECLARE @OPENQUERY nvarchar(4000), @TSQL nvarchar(4000), @LinkedServer nvarchar(4000);
DECLARE @name nvarchar(10) = 'Y4081';
SET @LinkedServer = 'linkedserver'
SET @OPENQUERY = 'DELETE FROM OPENQUERY('+ @LinkedServer +', '''
SET @TSQL = 'SELECT * FROM [MyDataBase].[dbo].[MyTable] 
WHERE Name = '+@name+' '')'
EXEC(@OPENQUERY+@TSQL)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linked #server #delete #openquery
ADD COMMENT
Topic
Name
1+9 =