user1526892
user1526892

Reputation: 67

Can we write a Insert query Lookup Activity in ADF

At the end of the pipeline I wanted to write the below query INSERT INTO [TestTable] (Job_name, status) VALUES (Job_name, current_timestamp()).

Jobname will be passed as a parameter.

Can this be written in Lookup, please let me know.

Upvotes: 1

Views: 3016

Answers (1)

Trent Tamura
Trent Tamura

Reputation: 1145

Definitely possible, but should you write massive inserts/scripts within a lookup... probably not a great idea, but see below (Truncate Example, but will work the same with an insert)

LOOKUP EXAMPLE

I use this method for small things like truncating a table, but never with big code that should be stored as source in the DB.

EDIT:

If you need to pass parameters or Variables into the lookup you should use string interpolation like so:

INSERT INTO dbo.MyTable
SELECT '@{variables('YourVariable')}' as Variable1,
'@{pipeline().Pipeline} as PipelineName

Upvotes: 1

Related Questions