Kenny_I
Kenny_I

Reputation: 2503

How to fetch Select statement from variable for Copy data activity in Azure Data Factory?

I have source query in Copy data activity of Azure Data Factory. Currently it is static query, but I would like to get entire statement from database and use that in Query in Activity.

I try to pass SQL statement as variable there is issue.

Lookup SQL Query for fetching Select statement:

SELECT [source_query] FROM [SalesLT].[configuration] WHERE [Id] = '1'

Query returns and set variable:

SELECT Count(CustomerId) Source_Rows FROM [SalesLT].[Customer]

Error with Copy data:

Type=System.Data.SqlClient.SqlException,Message=Incorrect syntax near 
')'.,Source=.Net SqlClient Data 

enter image description here

Upvotes: 0

Views: 653

Answers (1)

Utkarsh Pal
Utkarsh Pal

Reputation: 4544

You can't directly use the pipeline parameter in Query instead need to use @concat function to concatenate your SQL Query with parameters. Please refer the example below:

enter image description here

I suggest you to please go through this tutorial from @TechBrothersIT to get more clarification on the related issue.

Upvotes: 1

Related Questions