我有以下TSQl语句,它使用链接服务器从sage检索销售订单,但我不明白为什么这一行JrnlHdr.TransactionDate = cast(GETDATE())
给了我任何错误。我可以检索出JrnlHdr.TransactionDate = cast(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')
这是我收到的错误消息
链接服务器“SAGE”的OLE DB提供程序“PervasiveOLEDB.11.0” 返回消息“处理期间发生了一个或多个错误 命令。“。OLE DB提供程序”PervasiveOLEDB.11.0“用于链接服务器 “SAGE”返回消息“[Pervasive] [ODBC Engine Interface]语法 错误:N JrnlHdr.PostOrder = JrnlRow.PostOrder INNER JOIN LineItem ON JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber WHERE JrnlHdr.JrnlKey_Journal = 11 AND JrnlHdr.TransactionDate = cast(GETDATE()<< ???“。消息7321,级别16,状态2,行1错误 准备查询时出现“SELECT DISTINCT Customers.CustomerID,Customers.Customer_Bill_Name, Customers.WhichShipVia,LineItem.ItemID为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 客户INNER JOIN JrnlHdr ON Customers.CustomerRecordNumber = JrnlHdr.CustVendId LEFT OUTER JOIN地址ON Customers.CustomerRecordNumber = Address.CustomerRecordNumber INNER JOIN JrnlRow ON JrnlHdr.PostOrder = JrnlRow.PostOrder INNER JOIN LineItem ON JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber JrnlHdr.JrnlKey_Journal = 11 AND JrnlHdr.TransactionDate = cast(GETDATE())和JrnlHdr.PostOrder = JrnlRow.PostOrder AND JrnlHdr.CustVendId = Customers.CustomerRecordNumber AND JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber AND JrnlHdr.POSOisClosed = 0“对OLE DB提供程序执行 链接服务器“SAGE”的“PervasiveOLEDB.11.0”。
答案 0 :(得分:2)
由于您显然是在远程Pervasive数据库上执行查询,因此您需要使用该DBMS的语法,即Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.ocado.cfc.optimisation.AlgorithmInterface' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:348)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:335)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1093)
at com.ocado.cfc.optimisation.Executable.main(Executable.java:81)
而不是CURDATE()
。
答案 1 :(得分:0)
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(CURDATE()) AND JrnlHdr.PostOrder = JrnlRow.PostOrder AND JrnlHdr.CustVendId = Customers.CustomerRecordNumber AND JrnlRow.ItemRecordNumber = LineItem.ItemRecordNumber AND JrnlHdr.POSOisClosed = 0')