Sunday, February 19, 2012

HELP WITH UPDATE QUERY AND INNER JOIN AND OPENQUERY

If some could show me the syntax for updating a table in my database
with information in a linked table. the table I want to update is
called WorkList and I want to create an inner join query to a linked
table called public.FISCAL. This is all I have so far to create the
join...
SELECT DSK FROM OPENQUERY(SCH,'SELECT Account_ID FROM [public.FISCAL]')
AS A
INNER JOIN WorkList AS B
ON A.Account_ID = B.[ACCOUNT#]
Now how can I change it to make and Update query on field B.[I-Plan] = A.[I_PLAN]?update WorkList
set [I-Plan] = A.[I_PLAN]
from Worklist B
inner join SCH.[public].FISCAL
on Account_ID = B.[ACCOUNT#]
"mike11d11" wrote:
> If some could show me the syntax for updating a table in my database
> with information in a linked table. the table I want to update is
> called WorkList and I want to create an inner join query to a linked
> table called public.FISCAL. This is all I have so far to create the
> join...
> SELECT DSK FROM OPENQUERY(SCH,'SELECT Account_ID FROM [public.FISCAL]')
> AS A
> INNER JOIN WorkList AS B
> ON A.Account_ID = B.[ACCOUNT#]
> Now how can I change it to make and Update query on field B.[I-Plan] => A.[I_PLAN]?
>|||So this is what I have...
Select * FROM OPENQUERY(SCH,'SELECT [Account_ID], [I_PLAN] FROM
[public.FISCAL]') AS A
INNER JOIN WorkList AS B
ON A.Account_ID = B.[ACCOUNT#]
update WorkList
set [I-Plan] = A.[I_PLAN]
from Worklist B
inner join A
on Account_ID = B.[ACCOUNT#]
I'll give it a try!|||Here is the error I get when I use it.
Server: Msg 208, Level 16, State 1, Line 4
Invalid object name 'SCH.public.FISCAL'.|||anybody have an idea?

No comments:

Post a Comment