SQL Server Performance Forum – Threads Archive
Linked Servers – JOIN Query ErrorHi, I have linked 2 servers both running SQL Server 2005. I am able to run a query from one server and pull information from another. However whenever I try to join anything then I receive an error such as follows: Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Server.DBName.dbo.TableName.FielName" could not be bound. A simple test join that I’ve been trying is as follows: select * from TestX INNER JOIN t1 ON P_SEQNO = t1.i
Your simple test join is not using a multi-part identifier. Please post the query you run that is able to ‘pull information from another’, and the query that generates the error message you listed. Panic, Chaos, Disorder … my work here is done –unknown
Ack, sorry about that… I pasted the wrong JOIN query into the post select * from [Servername1Servername1].AcctDB.dbo.testTbl LEFT JOIN LocalDB.dbo.tbl1
ON [Servername1Servername1].AcctDB.dbo.testTbl.Col1 = LocalDB.dbo.tbl1.Col1 From the server where the LocalDB is located, I was able to run the following query: select * from [Servername1Servername1].AcctDB.dbo.testTbl So I am able to run simple selects error-free but when I try to join them then I get an error.
I found the problem with this query. I actually have to create aliases for the tables in order for JOINs to work.
Glad to hear it. Sometimes it’s the little things. I almost always alias my tables, and avoid aliases like ‘a’,’b’ etc. Give them meaningful names can often enhance readability and maintainability down the line, especially when you have, for example, recursive relationship’s = an alias such as ParentParty and ChildParty is far more helpful than ‘a’ and ‘b’. CiaO Panic, Chaos, Disorder … my work here is done –unknown