Hi, I'm running into an issue with a pre SQL script on a Azure SQL Sink in a Data Flow. What I'm attempting to do is the following:
- read a CSV file containing records that have a start and end date
- delete records from the sink Database that have the same start and end date
So in order to do achieve this I created a data flow as shown in the following screenshot:

The top flow reads a CSV source file, does a check, renames columns to match Database columns, cast columns to match database column types, filter certain records and finally add a derived column that concatenates the start and end date values formatted as 'MM/dd/yyyy-MM/dd/yyyy'.
The second flow will read the same CSV source file and determines the start/end date combinations in the source file and stores these (unique) values in a cache (column name 'billingPeriodStartAndEndDate').
In the DbCostDataOut sink I have pre SQL Dynamic expression that performs a delete on the sink table:
concat('delete from [dbo].[CspCostData] where [', 'BillingPeriodStartAndEndDates', '] in (', replace(replace(replace(toString(map(CachedBillingPeriod#outputs(), #item.billingPeriodStartAndEndDate)), '[', ''), ']', ''), '"', "'"), ')')
The query I'm trying to get is:
delete from [dbo].[CspCostData] where [BillingPeriodStartAndEndDate] in ('04/01/2023-04/30/2023', '05/01/2023-05/31/2023')
However when running the pipeline, the data flow fails with the following error message:

The '04/01/2023-04/30/2023' is the combination of start / end dates of the source data.
When I put the query as a string literal in pre SQL script field, no error occurs.
Is there any way where I can see the generated SQL query that is executed? Or does anyone know what is causing this error?