I have a local SQL Server Express database that I want to copy to a SQL Server database on a server. I do not have full permissions to the server, so I cannot directly attach it. Somebody told me I could do this by using the SqlBulkCopy[MSDN] class.
I can't figure out how to use it. I haven't done enough database programming to be familiar with how this sort of thing is done.
Basically, I want to copy all the tables in one database to another. There are relationships between the tables, I don't know if that will make a difference in the copying or not. There aren't very many, so it wouldn't be a big deal to just copy the data and then manually reassign the relationships.
This is as far as I could go
var localDatabase = new SqlConnection("connection string");
var serverDatabase = new SqlConnection("other connection string");
SomehowCopyAllTables(localDatabase, serverDatabase);
but unfortunately, Mr. C# didn't want to acknowledge the existence of the SomehowCopyAllTables method.
How can I copy all the tables from one database to another?
