I have 2 SQL servers .
dstest\mssql2008
<--I'm currently at this instance ( server)dstrn
<-- another server
Both servers has the same table called :
EServices_Pages_Content
Goal : I need to update data on dstest from dstrn
On the current server (dstest) I have :
I can(!) access dstrn
from dstest :
SELECT * FROM dstrn.weberp.dbo.EServices_Pages_Content WHERE pageid=80
OKay.
So where is the problem ?
As I told , I need to update data on dstest(current db) from a far server (dstrn) so I do :
UPDATE EServices_Pages_Content
SET [Content] = a.Content
FROM [dstrn].weberp.dbo.EServices_Pages_Content a
WHERE PageID = a.pageID
AND MasterEntityID = a.masterEntityid
AND LanguageID = a.LanguageID
AND PageID = 80
But I get an error :
Msg 209, Level 16, State 1, Line 4
Ambiguous column name 'PageID'.
Msg 209, Level 16, State 1, Line 5
Ambiguous column name 'MasterEntityID'.
Msg 209, Level 16, State 1, Line 6
Ambiguous column name 'LanguageID'.
Msg 209, Level 16, State 1, Line 7
Ambiguous column name 'PageID'.
I don't understand , I did use aliases , why does it tell me Ambiguous columns? How can I fix it ?
Edit : I found a way to make it work( see my answer) - but still can't understand why I need full table prefix in the where
clause. - and can't use aliases to prevent Ambiguity