在openedge中选择字段日期

csga3l58  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(321)

我正在尝试选择表中的“日期”字段 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函数,因此显示一个错误。
你们有人知道正确的语法吗?这样我就可以得到这个字段了?

cwdobuhd

cwdobuhd1#

语法错误是因为date是openedge sql中的保留字。只有用双引号分隔关键字,才能在sql语句中使用关键字作为标识符。
示例1:这将生成如您所述的语法错误

SQLExplorer>select date from pub.cust1;
=== SQL Exception 1 ===
SQLState=HY000
ErrorCode=-210056
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Syntax error in SQL statement at or about "date from pub.cust1" (10713)

示例2:这在我们用双引号分隔保留字时起作用

SQLExplorer>select "date" from pub.cust1;
date
----------

文档链接:https://documentation.progress.com/output/ua/openedge_latest/index.html#page/dmsrf/openedge-sql-reserved-words.html

相关问题