I've been searching for a long time with no useful answers.
The problem I'm facing is to take some rows out of a SQL table and create a new SQL table to store them in a different database in order to perform fast calculation on them later. The original table has more than a million rows and I'm taking out no more than 2,000 of them. The table has 277 columns and could be changing periodically so I need to generate new table copying the schema at run-time.
I'm now using MVC 5 and Sql Server 2008.
I tried taking out the data with linq but it couldn't push the data back to SQL Server.
I also tried taking out the schema with Select * from Table Where 1 = 0
, which gave me an empty datatable, but it still exists to create new table based on the schema.
I'm now trying to create the needed SQL based on datatype. It's a tiresome task and I have a strong feeling someone might have already done that.
Is there any out-of-the-box package or methods for this not-so-frequent task? Some of the questions I've searched for appeared about 9 years ago and I hope there's something for this at present.
The most ideal approach would be to use linq to query for the results and push the IQueryable back into database to create a new table.
Please help.