Using Reserved Word TimeStamp as a field name (Firebird 2.5)

十年热恋 提交于 2019-12-19 09:12:56

问题


I am extending the data layer of an existing application to work with Firebird 2.5, in addition to MSSQL and SQLite, but I have hit a stumbling block.

I have a field called TimeStamp which stores the data/time as type TimeStamp. This works fine under MSSQL and SQLite where the type is datetime, but falls over under Firebird. The following SQL:

SELECT SysTrnId,'TimeStamp' from "TRANSACTIONS"

seemingly works, but the TimeStamp field is return as fieldname "CONSTANT" and the contents are the text "timestamp"

Is it possible to do this under Firebird, or am I going to have to rename the field and change the code in the other data layers.


回答1:


The firebird escape character is the double quote ". Note that in firebird if you have a field that you have to escape with double quotes, it also becomes case sensitive. So, if you've declared your field as TimeStamp, then select "TIMESTAMP" ... will fail with a field not found error.




回答2:


I have no idea if it works, but have you tried double quotes around "TimeStamp", single quotes usually indicate a constant string.

Regards
K



来源:https://stackoverflow.com/questions/1800841/using-reserved-word-timestamp-as-a-field-name-firebird-2-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!