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)
 Multi part identifier error

Author  Topic 

skybvi
Posting Yak Master

193 Posts

Posted - 2011-04-08 : 12:49:05
Hi,
I am running this code :--

update #ff_1
SET #ff_1.upc =
case
when ff_discontinued.itemnmbr IN(select itemnmbr from #ff_1)
then '*'+ #ff_1.upc
else #ff_1.upc
end

from ff_discontinued
right join #ff_1 a
on a.itemnmbr= ff_discontinued.itemnmbr

select * from #ff_1

ERROR:-

Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "#ff_1.upc" could not be bound.


Regards,
Sushant
DBA
West Indies

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2011-04-08 : 13:02:53
[code]UPDATE a
SET #ff_1.upc =
case when ff_discontinued.itemnmbr IN(select itemnmbr from #ff_1) then '*'+ #ff_1.upc else #ff_1.upc end
from ff_discontinued
right join #ff_1 a
on a.itemnmbr= ff_discontinued.itemnmbr;[/code]

______________________
Go to Top of Page

skybvi
Posting Yak Master

193 Posts

Posted - 2011-04-08 : 13:10:01
:(

Same error



Regards,
Sushant
DBA
West Indies
Go to Top of Page

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2011-04-08 : 13:13:45
Oh,
What about this?
UPDATE a
SET a.upc =
case when ff_discontinued.itemnmbr IN(select itemnmbr from #ff_1) then '*'+ a.upc else a.upc end
from ff_discontinued
right join #ff_1 a
on a.itemnmbr= ff_discontinued.itemnmbr;


______________________
Go to Top of Page

skybvi
Posting Yak Master

193 Posts

Posted - 2011-04-08 : 13:27:00
It worked...
Thanks.


Regards,
Sushant
DBA
West Indies
Go to Top of Page

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2011-04-08 : 13:34:29
you are welcome

______________________
Go to Top of Page
   

- Advertisement -