If i run the script activity ,it will give an output in json , how to push that data in csv /anyother format to blob/database ???
Consider i have 1 million rows outputed from Script activity(Single Query) ??
CodePudding user response:
We can take the json output of script actvity and copy it to SQL database. Below is the approach.
- In Script actvity, Query is given in script settings.
select * from sampletb
**Output of the script activity: **
- Then Output of this activity is stored in a variable of string type.
@string(activity('Script1').output.resultSets[0].rows)
In SQL database, target table named
test_tgt
is created.Another script activity is taken and below script is written to copy to SQL database using below script.
declare @json nvarchar(4000)=N'@{variables('v1')}';
INSERT INTO test_tgt
SELECT * FROM OPENJSON(@json)
WITH (
Col varchar(60) ,
col1 varchar(50)
);