Solved

update from Backup table

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now