Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy data from a column from a table to another 1

Status
Not open for further replies.

Niavlys

IS-IT--Management
Jun 3, 2002
197
CA
Hi,
I know it should be an easy one but I can't figure out how to do this. I basically have 2 tables, one with 2 fields, FicheNumber and CaseNumber. The other table has the same fields with CaseNumber empty. I need to fill the CaseNumber column depending on the FicheNumber,

Code:
Table 1                            Table 2
_____________________________   __________________________
FicheNumber         CaseNumber  FicheNumber       CaseNumber

7656789             345         7656789
8763293             223         8763293
8763536             234         8763536
How to copy Case Number from Table 1 to Table 2 with a join on FicheNumber?
Thank you!
 
Make sure you have a good backup of your database before you run this.

Code:
Update Table2
Set    Table2.CaseNumber = Table1.CaseNumber
From   Table2
       Inner Join Table1
         On Table2.FicheNumber = Table1.FicheNumber


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top