【问题标题】:How to escape reserved word (keyword) in InterSystems Caché SQL?如何在 InterSystems Caché SQL 中转义保留字(关键字)?
【发布时间】:2017-11-03 16:31:32
【问题描述】:

我在 SQL 表中有一个名为 Date 的列,但不幸的是这个查询抛出了一个错误:

select Author, Date, Text from Tiny.Comment

我尝试使用 [Date]'Date' 转义 Date 关键字,但这对我来说从来没有用过。

【问题讨论】:

    标签: intersystems-cache intersystems


    【解决方案1】:

    在 InterSystems Caché SQL 中有点不同:您需要使用 double quotes 符号来转义关键字:

    select Author, "Date", Text from Tiny.Comment
    

    这也可以:

    select Author, myTable."Date", Text from Tiny.Comment as myTable where "Date"='2017-11-03 11:09:28'
    

    【讨论】:

      【解决方案2】:

      您还可以使用 %STRING 函数,例如:

      SELECT ID, Super 
      FROM %Dictionary.CompiledClass 
      WHERE %STRING(Super) %STARTSWITH %STRING('Base.%')
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-06-15
        • 2017-05-07
        • 1970-01-01
        • 2012-06-18
        • 1970-01-01
        • 2022-02-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多