我正在尝试选择表中的“日期”字段 UVT_DatesOfVersionsBOPos
使用microsoft sql server management studio (select * from openquery ([PROALPHA], 'select Date from PAVAR.PUB.UVT_DatesOfVersionsBOPos')
很遗憾,我收到以下错误消息:
The OLE DB provider "MSDASQL" for the connection server "PROALPHA" has the message "[DataDirect] [ODBC Progress OpenEdge Wire Protocol driver] [OPENEDGE] Syntax error in SQL statement at or about" Date from PAVAR.PUB.UVT_DatesOfVersionsB "( 10713) ".
Msg 7321, Level 16, State 2, Line 1
Failed to prepare the select date from PAVAR.PUB.UVT_DatesOfVersionsBOPos query to run for the OLE DB provider "MSDASQL" for the linked server "PROALPHA".
我假设sql将date字段解释为date函数,因此显示一个错误。
你们有人知道正确的语法吗?这样我就可以得到这个字段了?
1条答案
按热度按时间cwdobuhd1#
语法错误是因为date是openedge sql中的保留字。只有用双引号分隔关键字,才能在sql语句中使用关键字作为标识符。
示例1:这将生成如您所述的语法错误
示例2:这在我们用双引号分隔保留字时起作用
文档链接:https://documentation.progress.com/output/ua/openedge_latest/index.html#page/dmsrf/openedge-sql-reserved-words.html