Home > Mobile >  Add created on while copying data from SQL to azure data lake gen 2
Add created on while copying data from SQL to azure data lake gen 2

Time:11-19

I want to copy the data to SQL from csv file in ADLS gen2. In Sql table, there is a column called created on. But csv file doesn't have that column. How can I copy the current date in created on along with other columns?

CodePudding user response:

  1. You can add a column in source settings of copy activity and give the dynamic value as @utcnow() or
  2. Add a derived column transformation in dataflow and add the new column and give the data as currentUTC()

Method:1 [Using Copy Activity]

  • Copy activity is taken and in source settings, source dataset is taken.

enter image description here

  • Then Additional columns New is clicked. Created_on is given in Name and @utcnow() is given as dynamic content.

enter image description here

  • After adding new column, preview data of source dataset looks as in below image.

enter image description here

  • After this, file can be copied to sink.

Method:2 [Using Dataflow]

  • Source data is taken as in below image in dataflow. enter image description here

  • Derived column transformation is added and ADD is selected in columns. currentUTC() is given in the expression. enter image description here

enter image description here

  • By this way, you can add the column dynamically whenever the data is copied to SQL.
  • Related