I have a csv file that I am importing to a staging table in SQL Server 2014. In the staging table there are 10 columns for ticket numbers. The first column will always have a number but all the others could be null. If there is a value in any of the other columns I need to create a new row when inserting it to another table.
so my staging table looks like this:
ID tkt1 tkt2 tkt3 tkt4 ... tkt10
1 123456789 NULL NULL NULL
2 987654321 102345678 NULL NULL
3 555555555 444444444 333333333 NULL
Destination Table
ID tkt
1 123456789
2 987654321
2 102345678
3 555555555
3 444444444
3 333333333
I am trying to put this in a sp that imports the file to the staging table then inserts it to the destination.
thx,
Scott