linked server "SAGE" returned message "[ProvideX][ODBC Driver]Expected lexical element not found: <identifier>".

SOLVED

I have this query returning the error message. Any idea?

SELECT  A.SalesOrderNo,
B.UDF_COMPLETE_PART,
B.UDF_CUST_PART,
E.ExtendedDescriptionText,
B.UDF_Serial,
A.CustomerPONo,
A.UDF_EXT_CUST_PO,
A.ARDivisionNo,
D.CustomerNo,
D.CustomerName,
A.ConfirmTo,
A.EmailAddress,
A.UDF_END_USER,
A.UDF_REG_MANAGER,
A.UDF_REP_ACCT,
A.BillToName,
A.BillToCity,
A.BillToState,
A.ShipToName,
A.ShipToCity,
A.ShipToState,
C.CountryName,
A.RMANo,
F.ReceiptDate   
FROM        
{SO_SalesOrderHistoryHeader A   
inner join SO_SalesOrderHistoryDetail B on A.SalesOrderNo = B.SalesOrderNo    
inner join AR_Customer D on A.CustomerNo = D.CustomerNo and A.ARDivisionNo = D.ARDivisionNo        
inner join SY_Country C on C.CountryCode = D.CountryCode        
inner join CI_ExtendedDescription E on B.ExtendedDescriptionKey = E.ExtendedDescriptionKey        
Left join RA_ReceiptsHistoryHeader F on A.RMANo = F.RMano}
WHERE       
A.orderstatus = ''A''')

Parents
  • 0

    The ProvideX ODBC driver doesn't use the standard syntax for table joins.

    Refer to the attached document for more info on its usage.

    6886.PVX-ODBC4x.pdf

    You did mention linked server so i don't recall specifically whether SSMS expects its T-SQL syntax or if you have to use the PVX SQL syntax which uses some variant of the SQL-92 standard if i recall correctly.

    Moving along, in order to join tables, you have to use a {oj keyword in the join and you can't join more than one table per {oj keyword, you have to duplicate common joins and then use the WHERE clause to join the common tables together. In most cases, if you have  abunch of tables using inner joins, you can get away with not including the {oj keyword in the FROM clause and just list each table followed by its alias with commas separating each table and then use the WHERE clause to join them all to together.

    If you must include any kind of outer join, you must include the {oj keyword and the ON keyword in the join. Here is a basic example.

    SELECT * 
    FROM 
    {oj 
    CI_Item CII 
    Left Outer Join 
    SO_SalesOrderDetail SOD 
    On 
    ( 
    CII.ItemCode = SOD.ItemCode
    )
    }

    Keep in mind that any fields from a table joined as the outer join included in the WHERE clause will produce Inner Join results.

    If you have more than two tables involved and need an outer join between two of them, you can use the WHERE clause to handle the common joins to produce the inner joins and use the {oj join for the two tables that are needed in the outer join. Here is another basic example of this.

    SELECT * 
    FROM 
    SO_SalesOrderHeader SOH, 
    {oj 
    SO_SalesOrderDetail SOD 
    Left Outer Join 
    PO_PurchaseOrderHeader POH 
    ON 
    ( 
    SOD.PurchaseOrderNo = POH.PurchaseOrderNo 
    ) 
    } 
    WHERE 
    SOH.SalesOrderNo = SOD.SalesOrderNo 
     

Reply
  • 0

    The ProvideX ODBC driver doesn't use the standard syntax for table joins.

    Refer to the attached document for more info on its usage.

    6886.PVX-ODBC4x.pdf

    You did mention linked server so i don't recall specifically whether SSMS expects its T-SQL syntax or if you have to use the PVX SQL syntax which uses some variant of the SQL-92 standard if i recall correctly.

    Moving along, in order to join tables, you have to use a {oj keyword in the join and you can't join more than one table per {oj keyword, you have to duplicate common joins and then use the WHERE clause to join the common tables together. In most cases, if you have  abunch of tables using inner joins, you can get away with not including the {oj keyword in the FROM clause and just list each table followed by its alias with commas separating each table and then use the WHERE clause to join them all to together.

    If you must include any kind of outer join, you must include the {oj keyword and the ON keyword in the join. Here is a basic example.

    SELECT * 
    FROM 
    {oj 
    CI_Item CII 
    Left Outer Join 
    SO_SalesOrderDetail SOD 
    On 
    ( 
    CII.ItemCode = SOD.ItemCode
    )
    }

    Keep in mind that any fields from a table joined as the outer join included in the WHERE clause will produce Inner Join results.

    If you have more than two tables involved and need an outer join between two of them, you can use the WHERE clause to handle the common joins to produce the inner joins and use the {oj join for the two tables that are needed in the outer join. Here is another basic example of this.

    SELECT * 
    FROM 
    SO_SalesOrderHeader SOH, 
    {oj 
    SO_SalesOrderDetail SOD 
    Left Outer Join 
    PO_PurchaseOrderHeader POH 
    ON 
    ( 
    SOD.PurchaseOrderNo = POH.PurchaseOrderNo 
    ) 
    } 
    WHERE 
    SOH.SalesOrderNo = SOD.SalesOrderNo 
     

Children