Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a constant column value during data transfer from CSV to SQL?

I am reading in CSV file and translating it to an SQL Table. The kicker is that one of the columns in the table is of data type ID that needs to be set to a constant (in this case 2). I am not sure how to do this.

like image 538
Craig Avatar asked Aug 27 '08 23:08

Craig


People also ask

How do I add a constant to a column in SQL?

You can add static value when you use INSERT INTO SELECT MySQL query. Write the value directly in the select statement or you can add with the help of variable which initializes the value. SET @yourVariableName − = yourstaticValue; INSERT INTO yourSecondTableName(yourColumnName1,yourColumnName2,....

What is derived column in SSIS?

The Derived Column transformation creates new column values by applying expressions to transformation input columns. An expression can contain any combination of variables, functions, operators, and columns from the transformation input.


1 Answers

You can use a Derived Column Transformation in which you'll create a new output column and set its value to 2. You can then use that column when outputting to SQL.

like image 174
Farinha Avatar answered Oct 11 '22 10:10

Farinha