Solved

update from Backup table

Posted on 2011-09-07
2
293 Views
Last Modified: 2012-05-12
I have 2 tables.  Table1(Id,ColA,ColB,ColC) and TableBackup(Id,ColA,ColB,ColC).
Table2 has the same columns as Table1.
I would like to update ColA and ColB in Table1 with ColA and ColB from TableBackup.  The Id is the same in both tables.
How is best to do this?
0
Comment
Question by:johnkainn
  • 2
2 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 36498772
update Table1
set ColA = T2.ColA, ColB = T2.ColB
from Table1 T1
join Table2 T2
  on T2.Id = T1.Id
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 36498781
oops, use "TableBackup" instead of "Table2" in the join clause
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question