ColdCoffee (9/18/2010)
Varinder Sandhu (9/18/2010)
found the solutions...actually if the tables lie in different dbs
then create temp table in db X that contain the data of tableB from db Y
this way our both tables now in same db as X
now simply we can update from one table to another as usual 🙂
When u have data from different DBs, then accessing the tables using three part naming convention will help..
As in:
UPDATE tblA_dbX
SET tblA_dbX.Col2 = tblB_dbY.Col2
FROM dbX.dbo.TableA tblA_dbX -- See the 3-part naming here <DB_Name>.<Schema_Name>.<Table_Name>
JOIN dbY.dbo.TableB tblB_dbY -- See the 3-part naming here <DB_Name>.<Schema_Name>.<Table_Name>
ON tblA_dbX.Col1 = tblB_dbY.Col1
Or, am i missing something here ???
Sounds right to me. Creating a temp table is an extra step, uses extra space & resources.