I have a table from which I read using SqlCommand
variable, executing ExecuteReader
on it an the on the returned SqlDataReader
object I am interating to get each row, from where I do operations on the string to perform on insertion in the new DB using also a SqlCommand
variable and executing ExecuteNonQuery()
.
My question is if there is any more elegant/efficient way to do this ? Something like getting all the rows in one command and insert them all at once or anything else that is better than the current flow.
UPDATE One important thing is that the tables are in different databases on different servers.