May 12, 2009 at 1:33 pm
on sql2005, i run an update using a linked server. how come this works:
update linked_server.lcp.dbo.rpt_allocationdata
set a.allocation = b.esol
from lcp.dbo.working_table b inner join linked_server.lcp.dbo.rpt_allocationdata a on
b.usd = a.org_no
where a.code = 888888
but when i use the alias thusly in line 1 instead of the 4 part:
update a.rpt_allocationdata
set a.allocation = b.esol
from lcp.dbo.working_table b inner join linked_server.lcp.dbo.rpt_allocationdata a on
b.usd = a.org_no
where a.code = 888888
i get error:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'a.rpt_allocationdata'.
why doesn't it like the alias 'a' at this point?
May 12, 2009 at 2:01 pm
Try it like this:
update a
set a.allocation = b.esol
from lcp.dbo.working_table b inner join linked_server.lcp.dbo.rpt_allocationdata a on
b.usd = a.org_no
where a.code = 888888
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
May 12, 2009 at 2:16 pm
yes! this does work, and strangely makes me feel more at peace with the world. thank you.
May 12, 2009 at 3:00 pm
Glad I could help.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply