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

Update field values from one table to another

Status
Not open for further replies.

amillia

Programmer
Nov 14, 2001
124
US
UPDATE dbo.SoftOwnIndex, dbo.tblSoftwareOwnerComp SET dbo.SoftOwnIndex.Competency = [dbo.tblSoftwareOwnerComp].[Competency]
WHERE ((([dbo.softOwnIndex].[SOKey])=[dbo.tblSoftwareOwnerComp].[Pkey]))

The thing is that I get an error at the first comma. So I thought I would take out the second table name but then I get an error that it doesn't recognize the [dbo.tblSoftwareOwnerComp].[Competency] field.

So How should I right this? Maybe I need to select the field first but I don't know the syntax. Please Help!
 
This syntax shoudl work for you.

Code:
UPDATE [dbo].[SoftOwnIndex]
SET    dbo.SoftOwnIndex.Competency = [dbo].[tblSoftwareOwnerComp].[Competency]
From   dbo.SoftOwnIndex
       Inner Join dbo.tblSoftwareOwnerComp 
         On [dbo].[softOwnIndex].[SOKey]= [dbo].[tblSoftwareOwnerComp].[Pkey]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top