0

I have SQL-SERVER 2012 with two DB. I need to update the table test1 in DB1 from table test2 in DB2 if one of the columns changed.

How can i do that?

Thanks,

Tal

tal
  • 83
  • 1
  • 1
  • 8

1 Answers1

0

here is a syntax-

    UPDATE [database1]..[table1]
    SET tb1.[column1]= tb2.[column1],
        tb1.[column2] = tb2.[column2], 
        .
        .
        .
        .
        tb1.[column_n] = tb2.[column_n], 

    FROM [database1]..[table1] as tb1 JOIN [database2]..[table2] as tb2 
    ON tb1..[common_column] = tb2..[common_column]

SQL update from one Table to another based on a ID match

The beginner
  • 624
  • 4
  • 17