Dynamic SQL script in Azure

Santhi Dhanuskodi 66 Reputation points
2022-09-27T09:27:31.253+00:00

Hi I want to run a pre-sql script in sink activity.
My pre-sql script should be as below
'delete from

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

1 answer

Sort by: Most helpful
  1. Çağdaş SANCARBARLAZ 1 Reputation point
    2022-09-27T13:41:06.16+00:00

    Hello @Santhi Dhanuskodi

    Can you try this?

    DECLARE @SQLQuery nvarchar(1000)
    declare @ProductID varchar(50)
    set @ProductID = '123'
    SET @SQLQuery = 'SELECT ProductID,Name,ProductNumber FROM SalesLT.Product where ProductID = '+ @ProductID
    EXEC (@SQLQuery )

    ---

    Lütfen verilen bilgilerin size yardımcı olduğu her yerde " Cevabı kabul edin" ve "up-oylamayı" unutmayın, bu diğer topluluk üyeleri için faydalı olabilir.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.