Re: Update statment with two databases

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 09/05/04


Date: Sun, 5 Sep 2004 11:20:42 +0530

try something as follows, you should replace <owner> name with the required
owner name and <key_column> with the required key columns.

update a
set column2 = b.column2
from database1.<owner>.tableB a join database2.<owner>.tableB b
on a.<key_column> = b.<key_column>
where column2 = 'Completed'

OR

update database1.<owner>.tableB
set col1 =
(select col1 from database2.<owner>.tableB b
 where database1.<owner>.tableB.<key_column> = b.<key_column>)

-- 
Vishal Parkar
vgparkar@yahoo.co.in | vgparkar@hotmail.com