I need to split up one column into two columns. The data in the column is currently split by a dash (see below) and has parenthesis between the text.
Example of column: (Data1) - (Data2)
I have a Query that I used against the database that Works, but I am having trouble creating this Expression in SSIS.
Here are the queries I have used in SSMS that generate the New columns without the dash and parenthesis:
To get the data on the left side of the column into a New column:
SELECT SUBSTRING(REPLACE(REPLACE(REPLACE(COLUMN_NAME,'(',''),')',''),' ',''),0,CHARINDEX('-',
REPLACE(REPLACE(REPLACE(COLUMN_NAME,'(',''),')',''),' ',''))) AS NEW_COLUMN_NAME
FROM TABLE
To get the data on the right of the column into a New column:
SELECT SUBSTRING(REPLACE(REPLACE(REPLACE(COLUMN_NAME,'(',''),')',''),' ',''),CHARINDEX('-',
REPLACE(REPLACE(REPLACE(STREKNING_NAVN,'(',''),')',''),' ',''))+1,LEN(REPLACE(REPLACE(REPLACE(COLUMN_NAME,'(',''),')',''),' ',''))) AS NEW_COLUMN_NAME
FROM TABLE
Can anyone offer any tips?
Thank you in advance.