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

Update Query

Status
Not open for further replies.

iamtrying

Technical User
Sep 28, 2004
128
US
Hello,

I have two tables employee and cognosEmpData. I need to match the SSN in both tables and update the personelID column in the employee table if there are matching SSNs. For the remaining non matches,I would like to update the complete record record set from cognosEmpData to employee. Here is what I have so far:

update DBO.employee
set DBO.employee.sSN = DBO.cognosEmpData.SSN
from DBO.cognosEmpData
inner join DBO.employee ON DBO.cognosEmpData.SSN = DBO.employee.sSN
where DBO.employee.personnelID = DBO.cognosEmpData.personnelIDwhere DBO.employee.personnelID = DBO.cognosEmpData.personnelID
 
The fact that your table owner is "DBO" strongly suggests that you are using SQL Server for your rdbms, not Oracle. If so, you should repost this question in a SQL Server forum, probably forum183. There are quite a few differences between Oracle and SQL Server, so solutions that will work in Oracle might not work for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top