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
 General SQL Server Forums
 New to SQL Server Programming
 Update Statement

Author  Topic 

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2012-10-23 : 12:40:24
Hi,

I have the following update statement;

UPDATE    D
SET D .RefNo = Q.RefNo
FROM dbo.TblChangeControlDet INNER JOIN
dbo.QryRefNo Q ON D .ChangeID = Q.ChangeID


I receive the error -

The multi-part identifir "D.ChangeID" could not be bound.
Invalid object name 'D'

Why?

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-10-23 : 13:05:59
You just missed aliasing your table
UPDATE D
SET D .RefNo = Q.RefNo
FROM dbo.TblChangeControlDet D INNER JOIN
dbo.QryRefNo Q ON D .ChangeID = Q.ChangeID

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -