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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update using lookup table question

Status
Not open for further replies.

HPP

Technical User
Nov 7, 2002
4
0
0
IN
How can I update values in a table with values in another table where values in a common field are equal in SQL Server 7? In Access the following code works, but not in sql server

UPDATE tbl1 INNER JOIN tbl2
ON tbl1.CommonField = tbl2.CommonField
SET tbl2.FieldToUpdate = tbl1.FieldContainingValue
 
Try it this way (untested):

UPDATE tbl2
SET tbl2.FieldToUpdate = tbl1.FieldContainingValue
from tbl2
INNER JOIN tbl1
ON tbl1.CommonField = tbl2.CommonField


bp

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top