Author |
Topic |
venkath
Posting Yak Master
202 Posts |
Posted - 2006-06-07 : 13:12:31
|
Hi guys,How can i copy the column data between two servers which are having the same database.i.e., server A-database A-column 1to Server B-database A-Column 1Thanks in advance. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-07 : 13:17:44
|
What do you mean copy? Does the column already exist? Do you just want to update the data?Tara Kizeraka tduggan |
 |
|
venkath
Posting Yak Master
202 Posts |
Posted - 2006-06-07 : 13:32:47
|
The scenario is as followsI have a databaseB which is restored from databaseA and stored in other server to reduce the burdent on the server.By mistake, my developer updated all the data in a column to null.now i want to copy the data from the un affected database.Thanksquote: Originally posted by tkizer What do you mean copy? Does the column already exist? Do you just want to update the data?Tara Kizeraka tduggan
|
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-07 : 13:36:37
|
Add a linked server onto serverA. Then use the four part naming convention to perform the update:UPDATE bSET YourColumn = a.YourColumnFROM serverB.databaseB.dbo.YourTable b INNER JOIN databaseA.dbo.YourTable aON b.SomeColumn = a.SomeColumnTara Kizeraka tduggan |
 |
|
venkath
Posting Yak Master
202 Posts |
Posted - 2006-06-07 : 13:54:46
|
could u pls tell me the steps in adding the linked server...pls. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-07 : 13:59:19
|
You can find the steps in SQL Server Books Online. You can find them in Enterprise Manager if you click on Security..Linked Servers. Just right click and add one (make sure to select SQL Server as the server type). Tara Kizeraka tduggan |
 |
|
venkath
Posting Yak Master
202 Posts |
Posted - 2006-06-07 : 14:16:31
|
ok, i added the linked server and when i execute the above queryi am getting the following message..Login failed for user 'sa'.quote: Originally posted by tkizer You can find the steps in SQL Server Books Online. You can find them in Enterprise Manager if you click on Security..Linked Servers. Just right click and add one (make sure to select SQL Server as the server type). Tara Kizeraka tduggan
|
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-07 : 14:23:04
|
So the sa passwords must not be the same on both database servers. Go to the second tab in the linked server, select the 4th radio button, type in sa and the remote sa's password. You could also change the sa password temporarily so that they match. Once you are done with this, you'll want to delete this linked server, otherwise other with access to serverA will have sysadmin access on serverB.Tara Kizeraka tduggan |
 |
|
venkath
Posting Yak Master
202 Posts |
Posted - 2006-06-07 : 14:35:45
|
Thanks a lotI done it.. |
 |
|
|