I am trying to do a query via ODBC to our ERP database. The documentation guide suggests that we use OPENQUERY to send the query.
Here is my example query
SELECT
Q.Part_No,
Q.[Description],
Q.Part_Type
FROM OPENQUERY
(
LINKEDSERVER,
'
SELECT
P.Part_No,
P.[Description],
P.Part_Type
FROM LINKEDSERVER...Part_V_Part AS P
WHERE P.Part_No = ''2712768''
'
) AS Q
When I try to run that query though I get the following error
OLE DB provider "MSDASQL" for linked server "LINKEDSERVER" returned message "[LINKED][ODBC Plex ODBC Report Data Source driver][OpenAccess SDK SQL Engine]Syntax error in SQL statement. syntax error line 1 at or after token <LINKEDSERVER>.[0]".
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "
SELECT
P.Part_No,
P.[Description],
P.Part_Type
FROM LINKEDSERVER...Part_V_Part AS P
WHERE P.Part_No = '2712768'
" for execution against OLE DB provider "MSDASQL" for linked server "LINKEDSERVER".
Can anyone help me here? I've never used OPENQUERY before, but I'm coping the example straight as it is in the example documentation.