intersystems-cacheintersystems

How to escape reserved word (keyword) in InterSystems Caché SQL?


I have a column named Date in SQL table, but unfortunately this query throws an error:

select Author, Date, Text from Tiny.Comment

I've tried to escape the Date keyword with [Date] or 'Date' but this never worked for me.


Solution

  • In InterSystems Caché SQL it's a bit different: you need to use double quotes symbol to escape a keyword:

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

    This will also work:

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