Reputation: 67
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
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)
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