Hi, I have a similar situation to the question linked below. Basically I have a wide CSV file which looks like (basically):
Person, Status, Date, Answer1, Answer2 ... Answer 200.
Bob, Done, 1/1/10,5,3, 6,4,2...and so on
Joe, Done, 1/1/10,5,2,2,1,5...and so on
Most answers are numeric, but some questions allow text.
I'd like to end up with:
Person,Status,Date,AnswerN
um,AnswerV
al
Bob, Done, 1/1/10, 1, 5
Bob, Done, 1/1/10, 2, 3
and so on.
The volume of data is very manageable (maybe a few thousand respondents) and people will probably click an 'upload' button to import the result files- so I'd prefer to avoid SSIS/stored procedures if possible. Is there a method in LINQ, or a reasonably easy procedure in C# to rework this and append it to a database?
Many thanks for your thoughts!
https://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_23464968.html?sfQueryTermInfo=1+unpivot
Create a simple datatable with number of cols same as number of cols in first row and then keep on adding all the rows as and you read the lines.