views:

26

answers:

3

I have a datatable in memory that I got from a non SQL source.
What is the most elegant way, using ADO.NET to push it "as is into a new SQL (2005) server table?

+5  A: 

You'd need to do this as a series of steps. Firstly, creating the table via some dynamic SQL. Then you'd need to load the information from memory into the newly created table, potentially using a BULK INSERT.

Ardman
A: 

Or create the table on the SQL Server, read one row at a time, and add it to the table.

Beth
A: 
  • CREATE TABLE based on the structure
  • SQLBulkCopy it
gbn