OPENQUERY error: [OLE/DB provider returned message: Deferred prepare could not be completed.]...Statement(s) could not be prepared.

  • I'm getting the following error when attempting to compile a view that contains the code below:

    [OLE/DB provider returned message: Deferred prepare could not be completed.]

    Msg 8180, Level 16, State 1, Procedure viewName, Line 24

    Statement(s) could not be prepared.

    Msg 208, Level 16, State 1, Procedure viewName, Line 24

    Invalid object name 'dbo.Cmn'.

    Code:

    ...

    ...

    SELECT A.CID

    , CI.Jn

    , A.CSID

    , A.RD

    , CI.Dge

    FROM dbo.table1 AS A WITH(NOLOCK)

    INNER JOIN OPENQUERY ( linkedServerName,

    'SELECT d.col1

    , C.col2

    , k.col3

    FROM dbo.Cmn AS C WITH(NOLOCK)

    INNER JOIN ...' ) AS CI

    ON CI.CID = A.CID

    WHERE ( A.RD - CI.dprg ) <= ...

    GROUP BY ...

    ...

    ...

    Any ideas?

    The above view is running on a SQL 2000 instance but the linked server is targetting a SQL 2005 instance.

    Again, I get the error when I attempt to compile the view.

    I should mention that when I attempt to use the linked server this way it works fine:

    SELECT * FROM linkedServerName.DBName.dbo.Cmn

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

Viewing post 1 (of 1 total)

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