Search code examples
azure-data-factory

How to run stored procedure in Azure Data Factory DataFlow SQL Server source


When using an Azure SQL Server source, I use the Query option and specify a stored procedure to run. When I paste in the same code in Management Studio, it works, but when executed from ADF source using Query option, it errors with the following condition. How can I call a stored procedure using Query option?

{"message":"at Source 'Source': com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'EXECUTE'.. Details:at Source 'Source': com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'EXECUTE'.","failureType":"UserError","target":"SyncData","errorCode":"DFExecutorUserError"}

Here is the query I'm passing that works when called from SSMS:

EXECUTE [dbo].[sp_ReplicaGetChanges] @ReplicaVersion = 0, @FirstTimeFlag = 1, @SourceSchema = 'dbo', @SourceTable = 'Brand', @UpdateColumns = NULL

enter image description here


Solution

  • UDFs are supported in Data Flows, but not SPs

    https://learn.microsoft.com/en-us/azure/data-factory/connector-azure-sql-database#source-transformation