I have below SQL server query which builds a string like this: 'Group1', 'Group2', 'Group3'
SELECT '''' + '
STRING_AGG(CAST(groupname as NVARCHAR(MAX)), ''',''') + ''''
FROM groups
WHERE category = 'food'
I have a lookup expression
in a ADF pipeline
where I want to build the query dynamic using the @concat function
. This query is executed by the lookup expression in a SQL server database. The WHERE clause in the SQL statement needs to parameterized with a pipeline parameter. I tried below code but that does not work and gives me a error: missing comma between the arguments
How can I fix this?
@concat('
SELECT ''' +
STRING_AGG(CAST(groupname as NVARCHAR(MAX)), ''',''') + '''
FROM groups
WHERE category = ''',pipeline().parameters.Category,''''
)