-1

I have 2 databases, a live and backup. I want to overwrite the the values in a specific field in the live database from those that are in the backup. The database structure is identical the only difference is there name.

How do I do this?

TowelsRus
  • 55
  • 2
  • 9

1 Answers1

0

Try this

UPDATE liveDB
  SET column2 = src.column2 -----Whichever column you want
FROM BackupDB.dbo.Table1 AS src
INNER JOIN LiveDB.dbo.Table1 AS dest
ON src.column1 = dest.column1;

Updated

UPDATE live
SET l.ola_m_1= b.ola_m_1
FROM live.dbo.order_line l
JOIN backup.dbo.order_line b
ON --Whatever is Similar column between two
Richa
  • 3,261
  • 2
  • 27
  • 51
  • ok still struggling a bit here. the live database is called live, backups called backup. the table is called order_line_analysis in both databases and the filed is called ola_m_1 I barely know SQL so any extra help would be greatly appreciated. – TowelsRus Nov 26 '14 at 11:32
  • Hi I just can't get it to work..The databases are called dstgood & dstbad, the tables are both called order_line_analysis, the columns to update are called ola_m_1. dstbad needs updating with data from dstgood – TowelsRus Nov 26 '14 at 14:05