Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Error: multi-part identifier could not be bound

Author  Topic 

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2010-04-21 : 11:15:22
hi experts,

UPDATE TestDups
SET TestDups.lngCompanyID = Test.lngCompanyID
WHERE TestDups.strCompanyName = Test.strCompanyName
AND TestDups.strAddress = Test.strAddress;

I get this error:
The multi-part identifier "Test.strCompanyName" could not be bound.

The multi-part identifier "Test.strAddress" could not be bound.

I'm sure there is way to update the column but I'm lost as to how.

Thanks, John

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-21 : 11:20:40
Your TABLE Test occurs not in your query.
Try this:
UPDATE td
SET lngCompanyID = t.lngCompanyID
from TestDups td
join Test t on td.strCompanyName = t.strCompanyName
AND td.strAddress = t.strAddress;



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2010-04-23 : 17:50:30
Thank you, webfred. This worked perfectly!
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-24 : 06:22:25
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -