Solved

update from Backup table

Posted on 2011-09-07
2
295 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 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