Question:
How do you write an update statement between two MS SQL Server databases?
eaglefire5810
2006-05-13 20:08:39 UTC
I need to write an SQL statement that updates a table column in one database (pd1) with a value from a column in another database (pd1_test) both on the same MS SQL Server. I also need to do some correlations on records that will match between the two tables in the two databases. Please help!
Five answers:
r_ranjith
2006-05-14 12:29:14 UTC
Use the fully qualified table name as in the example:



update pd1.dbo.tablename set fieldname=(select fieldvalue from pd1_test.dbo.tablename)
?
2016-12-30 14:37:33 UTC
Update Statement Sql Server
anonymous
2016-10-01 09:54:06 UTC
Sql Server Update Statement
Thunder
2006-05-13 20:12:57 UTC
You can update from a column in another table, but not another database. You can, however, copy the table from one database to the other and then run the query between the tables.
melsatar
2006-05-13 20:18:12 UTC
i don't really remember the true syntax



but



like



update "name of table"

then condition of the primary key u put to not be repeated

like where ID = 1111



then write the attribute u like to change like



FNmae="mido" & Lname="hhh"



and so on





if like to move value of another table ..select the value first and accourding to this value update ur database


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...