Hello Rohit Kulkarni,
Can you use the below dynamic SQL and see if it helps?
DECLARE @sql NVARCHAR(MAX)
SET @sql = N'DELETE FROM [S4].' + QUOTENAME('@{pipeline().parameters.DESTINATION_TABLE_NAME}') + ' WHERE ERDAT >= @LastLoadDate OR ' + '@{pipeline().parameters.WHERE_SQL}'
EXEC sp_executesql @sql, N'@LastLoadDate datetime', @LastLoadDate = '@{item().LastLoadDate}'
Parameter value in table
Hello Team, I have hard coded values in one of the table
And I am passing this column as a parameter and try to delete some values .The below is mentioned querie: DELETE FROM [S4].[@{pipeline().parameters.DESTINATION_TABLE_NAME}] WHERE ERDAT >='@{item().LastLoadDate}' OR @{pipeline().parameters.WHERE_SQL} >='@{item().LastLoadDate}' I am getting error : ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Incorrect syntax near '>'.',Source=,''Type=System.Data.SqlClient.SqlException,Message=Incorrect syntax near '>'.,Source=.Net SqlClient Data Provider,SqlErrorNumber=102,Class=15,ErrorCode=-2146232060,State=1,Errors=[{Class=15,Number=102,State=1,Message=Incorrect syntax near '>'.,},],' Please advise. Regards Rohit
1 answer
Sort by: Most helpful
-
Bhargava-MSFT 31,121 Reputation points Microsoft Employee
2023-04-06T21:10:44.4066667+00:00