Openquery works but 4 part name table don''t

  • select

    * from openquery(LPUSA01,'select * from BZRCRP')     --- IT WORKS FINE

    select * from LPUSA01.LPUSA01.EBSTSTNEW.BZRCRP          ---- IT DOESN'T work

         give me this error:

    erver: Msg 7399, Level 16, State 1, Line 1

    OLE DB provider 'MSDASQL' reported an error. The provider did not give any information about the error.

    OLE DB error trace [OLE/DB Provider 'MSDASQL' IUnknown::QueryInterface returned 0x80004005:  The provider did not give any information about the error.].

    any ideas why?   since botth are using the same linked server and the first query ran whitout problems.

    thanks

     

  • Four part is Servername.DatabaseName.ObjectOwner.TableName

    your database name is the same as the servername?

    Something looks fishy, but not sure.

    Sorry if I'm not much of a help.

  • select * from LPUSA01.LPUSA01.EBSTSTNEW.BZRCRP

    this is a linked servr with AS400

    first LPUSA01 is the linked server.

    second LPUSA01 is the AS400 server name

    third EBSTSTNEW is the catalog or Database

    fourth BZRCRP is the table

    it works fine in another server

  • Try:

    select * from LPUSA01..EBSTSTNEW.BZRCRP

    Tom

     

  • I tried that and nothing same error, maybe Ineed to update the MDAC ??

  • I'm assuming your using an ODBC datasource for your connection and the name of the datasource is LPUSA01.  If not the the syntax should be.

    linkedserver.datasourcename.library.table

    Try that.

    Tom

  • Yes ... the linked server is LPUSA01 and the server name is LPUSA01

    That's my problem

    I'm doing  linkedserver.datasourcename.library.table

                 LPUSA01.LPUSA01.EBSTSTNEW.BZRCRP

    work fine in anohter SQL server but does not work on the development server.

    what Am I missing????

  • I'm just guessing now.  Do you have the latest client access and patches?  Have you tried deleting the datasource and recreating it.  Do you have the same datasource name on your computer that points to something else.  Are the login mappings correct.

    Once again just guessing.

    Tom

  • yes I do have all the patches up to date and client access also

    select * from openquery(LPUSA01,'select * from bzrcrp')   this work, same connection and work

    select * from LPUSA01.LPUSA01.EBSTSTNEW.BZRCRP   ...DO NOT WORK

     

    doesn't make any sense to me...

  • I did a google search on the error and several of the articles mentioned it being a security mapping issue.  Try mapping all users to a single 400 signon.

     

  • Well, this one works.

    SELECT * FROM LPUSA01...BZRCRP     WORKS !!!!

    thanks

     

     

  • Hi Nelson,

    The default behavior of the SQL Server is to parse the query locally. If you want the dynamic queries to be made and there parsing at the remote server, we use OPENQUERY() function. With this function, you are directing the SQL Server to parse and execute the query at the remote server (linked server in your case). With the first statement, you are actually sending the query to the linked server and the query is executed there, but with the second statement, SQL Server is trying to parse the query locally and hence it is throwing error.

     

    Pankaj Khanna
    Database Administrator - SQL Server 2000

    Keep hope to keep you intact...

  • What is the error you are getting when you are running 4 part name query?

     

    MohammedU
    Microsoft SQL Server MVP

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply