Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bh0526
Yak Posting Veteran
71 Posts |
Posted - 2010-06-24 : 10:51:38
|
Hi,I have 2 SQL 2005 databases. I have a table that is the same in both databases. But in one database, this table has no rows. So I simply want to copy all the rows from one table into the other database table. Please be aware that I have to VPN into these databases and they are on different servers. They will not allow me to have both VPN running at the same time. So I cannot Copy / Paste. What I want is a script that I can save.Thanks,Bob |
|
Kristen
Test
22859 Posts |
Posted - 2010-06-24 : 13:38:41
|
Can the two servers see each other direct?If so you could make a Linked Server connection between then and justINSERT INTO RemoteServer.RemoteDatabase.RemoteOwner.RemoteTableSELECT *FROM LocalTable SQL 2008 allows you to script a table as INSERT statements. There are scripts around that will do the same thing (i.e. for earlier SQL versions). If there are more than a few 1,000 rows in the table this will be a) very slow and b) a huge script.BCP will export the data to a file. Use NATIVE format (in effect a Binary Data File) which you can manually transfer to other machine (down-and-back-up using separate VPN connections) and then re-import - again, if you use the NATIVE format there is no chance of the data being messed up - which might be the case with CSV file or somesuch. |
|
|
|
|
|