Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3213902
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:59:53+00:00 2026-05-17T14:59:53+00:00

I am trying to do a query via ODBC to our ERP database. The

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T14:59:53+00:00Added an answer on May 17, 2026 at 2:59 pm

    Should be like this

        SELECT
     Q.Part_No,
     Q.[Description],
     Q.Part_Type
    FROM OPENQUERY
    (
     LINKEDSERVER,
     '
     SELECT
      P.Part_No,
      P.[Description],
      P.Part_Type
     FROM DatabaseName.SchemaName.Part_V_Part AS P
     WHERE P.Part_No = ''2712768''
     '
    ) AS Q
    

    Replace DatabaseName and SchemaName with your actual database name and schemaname (probably dbo)

    You don’t need the linked server name inside the query

    Take a look at Having Fun With OPENQUERY And Update,Delete And Insert Statements for some examples

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send a list of IPs from a Postgres query via e-mail.
I'm trying to accomplish a query that requires a calculated column using a subquery
I'm trying to program a simple search in google via C# that would run
We are trying to connect to Sql Server 2005 via Oracle 11gR2 gateway and
I'm trying to create a linked server in MS SQL Server 2005, pointing to
I'm trying to figure this out, I was asking this question in Liferay's forum
I have the following XML which I load via XDocument.Load(uri) or XElement.Load(uri) . I
So I've got the following situation: $do = mysql_query($sql); return array(data=>array(mysql_fetch_object($do)), rows=>mysql_affected_rows()); Which is
I'm breaking my grails application into modules by using plugins and then adding the
So, I've looked all over the web for this simple answer...and I can't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.