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
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