I have a single row of data (name, address, question_ID_1, Answer_1, question_ID_2, Answer_2, etc) and wish to unpivot this so that it reads:
row1: name, address, question_ID_1, Answer_1;
row2: name, address, question_ID_2, Answer_2;
row3: name, address, question_ID_3, Answer 3; etc.
I have managed to get a variation of this but not the final result. I have concatenated the Question and Answer fields and dont mind unpivoting using this - so...
row1: name, address, QA1;
row2: name, address, QA2;
row3: name, address, QA3 etc.
I have a variable number of columns depending on the import too.
I am importing a flat file (using SSIS) into a SQLServer 2005 table,and then transforming the data into the chosen format using a stored procedure. Any code you can supply would be a great help.