Quickest way to insert records from one db into another
Posted on 2006-10-20
I have a DataTable entitled "dtSource" from database 'A'. I would like to push the data into database 'B'. Both databases are SQL Server 2005 and both table schemas are the same.
I suppose I could loop through the rows like so:
string sql = "";
foreach(DataRow dr in dt.Rows)
sql += "INSERT INTO...."
sql += dr.ToString() + ", ";
There has to be a faster and/or more of an elegant way of doing this.