Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update field with data from another database [closed]

Need to update a field with data from another field in a different database

I Have two SQL commercial Databases from the same company, the first Database has one field that is null in the other

I need to update the Field/Database that is null with the data of the first one.

like image 627
MikeRTeixeira Avatar asked Feb 07 '11 13:02

MikeRTeixeira


1 Answers

MS SQL Server

Update table1 in current database from table1 in database called "DataBaseName"

update table1
set col2 = T2.col2
from DataBaseName.dbo.table1 as T2
  where table1.ID = T2.ID and
        table1.col2 is null
like image 142
Mikael Eriksson Avatar answered Oct 20 '22 18:10

Mikael Eriksson