I think the answer above is not entirely clear.
You must create a table with SQL. There is no other way. And if you just need to create a column structure, then it is quite simple, if your source is on the same server, this is enough:
Select * from source_table into destination_table where 1=2
If your source is not on the same server (for example, an excel or dbf file or something else), the easiest way is to connect to it using ODBC (or SQL, if possible) and send it:
Select * from source_table where 1=2
and then collect the result in a DataTable. Then in the second step, you must create a stored procedure on the target server, which will take this table as an argument, and then insert it into the new table.
More specifically, try this for the SQL procedure: http://www.builderau.com.au/program/sqlserver/soa/Passing-table-valued-parameters-in-SQL-Server-2008/0,339028455,339282577,00 .htm
And create a SqlCommnand object in C # and add to its parameter set SqlParameter, which is SqlDbType.Structured
I did not go into every detail, but I hope this can help.
Ivan Ičin
source share