使用保留字时间戳作为字段名称(Firebird 2.5) [英] Using Reserved Word TimeStamp as a field name (Firebird 2.5)

查看:91
本文介绍了使用保留字时间戳作为字段名称(Firebird 2.5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了MSSQL和SQLite,我正在扩展现有应用程序的数据层以与Firebird 2.5一起使用,但遇到了绊脚石.

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.

我有一个名为TimeStamp的字段,该字段将数据/时间存储为TimeStamp类型.在类型为datetime的MSSQL和SQLite下,此方法可以正常工作,但在Firebird下适用.以下SQL:

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"

貌似可行,但是TimeStamp字段以字段名"CONSTANT"返回,内容为文本"timestamp"

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

是否可以在Firebird下执行此操作,或者我是否必须重命名该字段并更改其他数据层中的代码.

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.

推荐答案

firebird转义字符是双引号".请注意,在firebird中,如果您必须使用双引号将其转义,则它也区分大小写.因此,如果您已将字段声明为TimeStamp,则select "TIMESTAMP" ...将失败,并显示未找到字段的错误.

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.

这篇关于使用保留字时间戳作为字段名称(Firebird 2.5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆