July 23, 2003 at 9:37 pm
I am new to sql world. could anyone tell me how can i copy a list of record (under certain condition, like size > 10) in table A of dbA to table b in dbB? Thanks
July 24, 2003 at 4:21 am
Probably several options to do this.
One would be to set up the two servers as linked Servers.
This can be fairly easily through Enterprise manager: Security, Linked Servers (see Books on Line), however if this is just a one off, suggest you remove the link afterwards, else read up on the security aspects.
Then just do an insert statement, referencing each table using the four part naming convention required with Linked Servers: Server.Database.Owner.Table:
Ie:
insert into serverA.database.dbo.TableA (...)
select ... from serverB.database.dbo.TableB
where ....
Or instead of linked servers, and again if this is just a one off, TableA can be copied from serverA down to ServerB (Select Database in ServerB, right click All Tasks, Import Data: follow wizard, select the table, rename if necessary).
Once copied down, the same insert concept as above (without the Server Name) can be applied.
July 24, 2003 at 12:57 pm
July 24, 2003 at 1:47 pm
A bit more complicated at the beginning but faster in the end, would be to use the bcp command to export, and bulk insert to import.
In my test I have found this is the fastest way to copy data.
But you should read BOL for all the options and parameters.
July 26, 2003 at 5:30 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply