Basically I want to delete some data before loading new data into a table in the ADF pipeline. So I have to use below script as Pre-copy script of my copy data - sink.
DELETE FROM HCP_CALL_CNT WHERE call_mo = '2023-04'
Instead of hard coding '2023-04', I want to use year & date of utcNow() to construct this, but my below statement does not work.
DELETE FROM HCP_CALL_CNT WHERE call_mo = @concat('@{utcNow('yyyy')}', '-', '@{utcNow('MM')}')
I get an error: Failure happened on 'Sink' side. ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [42000] SQL compilation error: syntax error line 2 at position 16 unexpected '@concat'. syntax error line 2 at position 24 unexpected ''2023''.,Source=Microsoft.DataTransfer.Runtime.GenericOdbcConnectors,''Type=System.Data.Odbc.OdbcException,Message=ERROR [42000] SQL compilation error: syntax error line 2 at position 16 unexpected '@concat'. syntax error line 2 at position 24 unexpected ''2023''.,Source=SnowflakeODBC_sb64.dll,'
Can you please help? Thanks in advance! Anu
Tried: DELETE FROM HCP_CALL_CNT WHERE call_mo = @concat('@{utcNow('yyyy')}', '-', '@{utcNow('MM')}')
Expecting: DELETE FROM HCP_CALL_CNT WHERE call_mo = '2023-04'
please use below logic : DELETE FROM HCP_CALL_CNT WHERE call_mo = '@{utcnow('yyyy')}-@{utcnow('MM')}'