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
 multi-part identifier error

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 10:59:54
im using this code and getting the following any ideas why
UPDATE dbo.TempSimulation 
SET generic.HistoricalPrice.ShareCurrency= dbo.TempSimulation.ShareCurrency

FROM dbo.TempSimulation
INNER JOIN generic.HistoricalPrice ON
dbo.TempSimulation.ThirdSimulation= generic.HistoricalPrice.ISIN


Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "generic.HistoricalPrice.ShareCurrency" could not be bound.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-13 : 11:06:33
[code]
UPDATE t
SET t.ShareCurrency= g.ShareCurrency
FROM dbo.TempSimulation t
INNER JOIN generic.HistoricalPrice g
ON t.ThirdSimulation= g.ISIN
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 11:07:44
ok thanks will try that
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 11:07:44
ok thanks will try that
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-03-13 : 11:08:18
if that still doesn't work:
"could not be bound" error often means that the table definition was changed (like a dropped/renamed column). If either of these objects are views and the underlying DDL changed then then you need to recompile the view and don't use "select *" in the view but rather an explicit column list.

Be One with the Optimizer
TG
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 11:10:41
that doesnt work i have to have it like this
SET g.ShareCurrency = t.ShareCurrency
as i want to update the t.sharecurrency values with the g.sharecurrency values
so when i change it back get same error
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-13 : 11:14:07
is the column name correct? ie ShareCurrency

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 11:15:38
ya the column name is def correct
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-13 : 11:20:45
i'm asking on HistoricalPrice table

post the DDL for the tables please

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 11:25:16
ya its def right i dragged and drop it over to my query to make sure
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-13 : 11:29:51
dragged and dropped from where?

can you post your exact query now?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2013-03-13 : 11:31:20
update ts
set hp.ShareCurrency = ts.ShareCurrency
from generic.HistoricalPrice hp
INNER JOIN dbo.TempSimulation ts
ON ts.ThirdSimulation= hp.ISIn

column names are def right
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-13 : 11:33:10
why cant you use it as suggested? you still have it other way around!


update ts
set ts.ShareCurrency = hp.ShareCurrency
from generic.HistoricalPrice hp
INNER JOIN dbo.TempSimulation ts
ON ts.ThirdSimulation= hp.ISIn


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -