I have a linked server pulling data from a ProvideX database. I've created a view to combine data from two tables.
When I execute this I'm getting the following error:
-------------------------
SQL Execution Error.
Executed SQL statement: SELECT OrderDate.ToString() AS OrderDate, InvoiceDate.ToString() AS InvoiceDate, InvoiceNo, HeaderSeqNo, CustomerNo, CustomerPONo, ShipToName, ItemCode, QuantityShipped, WarehouseCode, ExtensionAmt FROM OPENQUERY (mas_xyz , 'Select a.OrderDate, a.Inv...
Error Source: .Net SqlClient Data Provider
Error Message: Cannot find either column "OrderDate" or the user-defined function or aggregate "OrderDate.ToString", or the name is ambiguous.
-------------------------
If I query the one of the tables directly:
I get the following data:
InvoiceNo | InvoiceDate
10012 | 1/15/2003
10013 | 3/12/2003
10014 | 3/12/2003
If I alias the date fields I get no error, the columns are just excluded from the view.
I assume the error is related to a problem with my date formats but I cannot figure out how to format them properly. Any help is GREATLY appreciated!!
Code:
SELECT OrderDate, InvoiceDate, InvoiceNo, HeaderSeqNo, CustomerNo, CustomerPONo, ShipToName, ItemCode, QuantityShipped, WarehouseCode, ExtensionAmt
FROM OPENQUERY(mas_xyz,
'Select a.OrderDate, a.InvoiceDate, a.InvoiceNo, a.HeaderSeqNo, a.CustomerNo, a.CustomerPONo, a.ShipToName, b.ItemCode, b.QuantityShipped, b.WarehouseCode, b.ExtensionAmt from ar_invoiceHistoryHeader a, ar_invoicehistorydetail b
where a.invoiceno=b.invoiceno and a.headerseqno=b.headerseqno')
AS vInvoiceHistory
When I execute this I'm getting the following error:
-------------------------
SQL Execution Error.
Executed SQL statement: SELECT OrderDate.ToString() AS OrderDate, InvoiceDate.ToString() AS InvoiceDate, InvoiceNo, HeaderSeqNo, CustomerNo, CustomerPONo, ShipToName, ItemCode, QuantityShipped, WarehouseCode, ExtensionAmt FROM OPENQUERY (mas_xyz , 'Select a.OrderDate, a.Inv...
Error Source: .Net SqlClient Data Provider
Error Message: Cannot find either column "OrderDate" or the user-defined function or aggregate "OrderDate.ToString", or the name is ambiguous.
-------------------------
If I query the one of the tables directly:
Code:
SELECT InvoiceNo, InvoiceDate
FROM OPENQUERY(mas_xyz, 'SELECT InvoiceNo, InvoiceDate FROM AR_InvoiceHistoryHeader')
I get the following data:
InvoiceNo | InvoiceDate
10012 | 1/15/2003
10013 | 3/12/2003
10014 | 3/12/2003
If I alias the date fields I get no error, the columns are just excluded from the view.
I assume the error is related to a problem with my date formats but I cannot figure out how to format them properly. Any help is GREATLY appreciated!!