📅  最后修改于: 2022-03-11 15:05:12.205000             🧑  作者: Mango
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)