I am new to C# and I am trying to write an application that will copy data from one database and create a new table and insert the data into this new table.
The SQL statement I want to use is something like "Create Table Blah as Select * from OtherTable" or Select * into Blah from OtherTable"
I am dealing with 2 different database programs. I want to retrieve the results of a query another database program (Teradata) and copy it directly into SQL Server and create the table on the fly.
I am assuming that using a SqlDataAdapter would be the best way. The data that I will be pulling from Teradata is a static so I could use a SqlDataReader if that would work better.
Does anyone have any suggestions?
That looks like it will do most of what I want. I was hoping to find a way to also create the table in SQL Server on the fly. SqlBulkCopy looks like the table has to exist before it will work.
I think I should be able to look at either the DataSet or the DataAdaptor and find out what the column names and types are in the Source table and use that to build a string that I can pass to SQL Server in a Create Table command to create the table before I run the SqlBulkCopy command.
Thanks for your help.