リンクサーバーを使用してセージからセールスオーダーを取得するTSQlステートメントがありますが、なぜこの行JrnlHdr.TransactionDate = cast(GETDATE())
がエラーを表示するのかわかりません。 JrnlHdr.TransactionDate = cast(GETDATE())
を使ってすべてのレコードを取り出すことができますが、今日作成された受注だけを見たいと思っています。リンクサーバーのgetdate()にエラーが発生しました
ここselect文
SELECT * FROM OPENQUERY([SAGE],'SELECT DISTINCT Customers.CustomerID, Customers.Customer_Bill_Name, Customers.WhichShipVia,
LineItem.ItemID as I, JrnlHdr.INV_POSOOrderNumber, JrnlHdr.CustomerInvoiceNo,
JrnlHdr.Comment2, JrnlHdr.ShipByDate, JrnlHdr.GoodThruDate, JrnlHdr.CustomerSONo, JrnlHdr.Reference, JrnlHdr.TransactionDate,
JrnlRow.DistNumber, CAST (JrnlRow.Quantity AS NUMERIC (20,4)), LineItem.ItemID, LineItem.SalesDescription, LineItem.PartNumber, LineItem.Category, LineItem.ItemClass, LineItem.ItemDescription
FROM Customers
INNER JOIN JrnlHdr
ON Customers.CustomerRecordNumber = JrnlHdr.CustVendId
LEFT OUTER JOIN Address
ON Customers.CustomerRecordNumber = Address.CustomerRecordNumber
INNER JOIN JrnlRow
ON JrnlHdr.PostOrder = JrnlRow.PostOrder
INNER JOIN LineItem
ON JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber
WHERE JrnlHdr.JrnlKey_Journal = 11 AND JrnlHdr.TransactionDate = cast(GETDATE()) AND JrnlHdr.PostOrder = JrnlRow.PostOrder AND JrnlHdr.CustVendId = Customers.CustomerRecordNumber AND JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber AND JrnlHdr.POSOisClosed = 0')
ここでは、私は
OLE DB provider "PervasiveOLEDB.11.0" for linked server "SAGE" returned message "One or more errors occurred during processing of command.". OLE DB provider "PervasiveOLEDB.11.0" for linked server "SAGE" returned message "[Pervasive][ODBC Engine Interface]Syntax Error: N JrnlHdr.PostOrder = JrnlRow.PostOrder INNER JOIN LineItem ON JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber WHERE JrnlHdr.JrnlKey_Journal = 11 AND JrnlHdr.TransactionDate = cast(GETDATE()<< ??? ". Msg 7321, Level 16, State 2, Line 1 An error occurred while preparing the query "SELECT DISTINCT Customers.CustomerID, Customers.Customer_Bill_Name, Customers.WhichShipVia, LineItem.ItemID as I, JrnlHdr.INV_POSOOrderNumber, JrnlHdr.CustomerInvoiceNo, JrnlHdr.Comment2, JrnlHdr.ShipByDate, JrnlHdr.GoodThruDate, JrnlHdr.CustomerSONo, JrnlHdr.Reference, JrnlHdr.TransactionDate, JrnlRow.DistNumber, CAST (JrnlRow.Quantity AS NUMERIC (20,4)), LineItem.ItemID, LineItem.SalesDescription, LineItem.PartNumber, LineItem.Category, LineItem.ItemClass, LineItem.ItemDescription FROM Customers INNER JOIN JrnlHdr ON Customers.CustomerRecordNumber = JrnlHdr.CustVendId LEFT OUTER JOIN Address ON Customers.CustomerRecordNumber = Address.CustomerRecordNumber INNER JOIN JrnlRow ON JrnlHdr.PostOrder = JrnlRow.PostOrder INNER JOIN LineItem ON JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber WHERE JrnlHdr.JrnlKey_Journal = 11 AND JrnlHdr.TransactionDate = cast(GETDATE()) AND JrnlHdr.PostOrder = JrnlRow.PostOrder AND JrnlHdr.CustVendId = Customers.CustomerRecordNumber AND JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber AND JrnlHdr.POSOisClosed = 0" for execution against OLE DB provider "PervasiveOLEDB.11.0" for linked server "SAGE".
Pervasive DB/PSQLの良い点:-)私の答えを無効にします! – Phylyp