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!

Need help with this query

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i have two sql tables both have same colums

TABLE a (5000 records) TABLE B( (20 records)
------------- ------------
a.ID b.ID
a.Customername b.Customername
a.Update date b.Update date

i need to update all ROWS and COLUMNS in TAble A if the Id's match
But when i do an UPDATE query it wont allow me to do this can someone show me a way to do this.
Do i use and insert or a stored procedure can someone please show me the code.

Thanks
 
I'm not exactually sure what you mean, but you can join two tables in an update statement:

update a
set id = newid,
customername = newcustomername,
updateDate = newupdateDate
from a,
b
where b.id = a.id
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top