Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ah yes, the joy of linked servers!

Status
Not open for further replies.

lemunk

Programmer
Nov 15, 2011
1
GB
hello fellow programmers!

So ive made a linked server on sql server manager.
reason for this is due to me having to join a table from my local server to a table from a different server.
using the GUI i made a linked server that works.
the table on my local server is actually a view that join 2 other tables, this also works no problems.

the problem is the following
(btw im fairly new to SQL so im hoping its some stupid syntax ive missed)


CREATE PROCEDURE LinkRepParetoCHECK1
AS
SELECT
A.Acct,
A.Name,
A.Document,
A.Part,
B.Pareto,
A.PG,
A.Qty,
A.Unit,
A.[datetime],
A.Year_1,
A.Month_1
FROM
[vSpends] A
INNER JOIN
OPENQUERY(sacb3, 'SELECT Pareto FROM Shaftdata.dbo.NEWPareto') B
ON
A.part = B.part;

so as you can see, aim attempting to write a stored procedure that will execute this join so that my C# client im writting can simply call it as and when.

BUT the error im getting is,

Msg 207, Level 16, State 3, Procedure LinkRepParetoCHECK1, Line 4
Invalid column name 'part'.

ive played around with the logic and syntax with no luck. Any1 out there see what ive done wrong or missed?
Many thanks
Steve
 


There is no column [Part] returned from your OPENQUERY, just a column [Parato]. Thus no b.part to join to your a.part


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top