Hi,
I’ve got some issues when trying to build up SSIS solution during data collecting, could anyone provide some ideas/comments? Many thanks
I’ve got a csv file contains several columns, what I need to do is to separate these columns into 2 database table: Table A and Table B. A quick example can be shown as follows:
The original file contains the Records as Follows (Contain Headers in the first row))
ID Info A1 A2 B1 B2 C1 C2
10 Test1 11 22 33 44 55 66
11 Test2 12 13 14 15 16 17
The main table above need to be processed in SSIS and feed the data into 2 separate tables: Table A and Table B:
Table A should contain the data as follows:
ID Info A_ID B_ID C_ID
10 Test1 101 102 103
11 Test2 111 112 113
ID is Primary Key; A_ID, B_ID and C_ID is Foreign Key link to Table B Session_ID.
It should be noted that the A_ID, B_ID and C_ID is the combination of ID+ColumnCount. As ID is unique, then ID + Column count for each row will provide the unique ID for each record in Table B.
For instance, the first row of Table A, Column’A_ID’ is generated by the ID (10) plus ColumnCount (1).
Table B contains the data below:
ID Session_ID 1st_Parameter 2nd_Parameter
10 101 11 22
10 102 33 44
10 103 55 66
11 111 12 13
11 112 14 15
11 113 16 17
Session_ID is the Primary Key for Table B and ID is the foreign Key link to Table A ID.
I am stucking on 2 issues for weeks now and nothing move so far, any ideas will be very helpful, appreciate!
- How to do the ID+ColumnCount combination? As the column count need to set back to zero after process each row.
- In SSIS, How to separate records in Table A and add to Table B
Best Regards
Stephen