Reputation: 1041
I have a CSV file and one of the columns is concatenated like: ".col1:.col2"
I am using SSIS to load CSV file into a SQL table.
How can I separate the column?
Thanks.
Upvotes: 1
Views: 661
Reputation: 4094
Here is how you could do it:
Col1, with the expression: SUBSTRING(COLNAME, 1, FINDSTRING(COLNAME, ":", 1) - 1)
Col2, with the expression: SUBSTRING(COLNAME, FINDSTRING(COLNAME, ":", 1) + 1, LEN(COLNAME) - FINDSTRING(COLNAME, ":", 1))
Finally, load the relevant fields of the dataflow into you Sql destination.
I haven't tested the expressions myself, so they might have some one-off errors.
Upvotes: 2