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:
- You can add a column in source settings of copy activity and give the dynamic value as
@utcnow()
or - 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.
- Then Additional columns New is clicked. Created_on is given in Name and
@utcnow()
is given as dynamic content.
- After adding new column, preview data of source dataset looks as in below image.
- After this, file can be copied to sink.
Method:2 [Using Dataflow]
Source data is taken as in below image in dataflow.
Derived column transformation is added and ADD is selected in columns.
currentUTC()
is given in the expression.
- By this way, you can add the column dynamically whenever the data is copied to SQL.