Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 (中文) » SQL Anywhere 服务器 - SQL 参考 » SQL 语言元素 » 关键字

 

保留字

SQL 中的一些关键字也是保留字。要在 SQL 语句中使用保留字作为标识符,可用双引号、方括号或反引号将它括起来。SQL 语句中出现的很多关键字都是保留字。例如,使用以下语法可检索名为 SELECT 的表的内容。

SELECT *
   FROM "SELECT"

SQL 关键字不区分大小写,因此以下关键字可能会以大写形式、小写形式或两种形式的任意组合显示。与以下某个字仅在大小写形式上有所不同的所有字符串都是保留字。

也可以使用 non_keywords 选项关闭关键字。

reserved_keywords 选项可打开缺省禁用的各个关键字。

如果使用嵌入式 SQL,可以利用数据库库函数 SQL_needs_quotes 确定一个字符串是否需要加上引号。如果一个字符串是保留字,或者包含标识符中通常不允许的字符,则该字符串需要加上引号。

可以使用 sa_reserved_words 系统过程获得保留字的列表。

SQL Anywhere 中有以下保留的 SQL 关键字:

add all alter and
any array as asc
attach backup begin between
bigint binary bit bottom
break by call capability
cascade case cast char
char_convert character check checkpoint
close comment commit compressed
conflict connect constraint contains
continue convert create cross
cube current current_timestamp current_user
cursor date datetimeoffset dbspace
deallocate dec decimal declare
default delete deleting desc
detach distinct do double
drop dynamic else elseif
encrypted end endif escape
except exception exec execute
existing exists externlogin fetch
first float for force
foreign forward from full
goto grant group having
holdlock identified if in
index inner inout insensitive
insert inserting install instead
int integer integrated intersect
into is isolation join
json kerberos key lateral
left like limit lock
login long match membership
merge message mode modify
natural nchar new no
noholdlock not notify null
numeric nvarchar of off
on open openstring openxml
option options or order
others out outer over
passthrough precision prepare primary
print privileges proc procedure
publication raiserror readtext real
reference references refresh release
remote remove rename reorganize
resource restore restrict return
revoke right rollback rollup
row rowtype save savepoint
scroll select sensitive session
set setuser share smallint
some spatial sqlcode sqlstate
start stop subtrans subtransaction
synchronize table temporary then
time timestamp tinyint to
top tran treat trigger
truncate tsequal unbounded union
unique uniqueidentifier unknown unnest
unsigned update updating user
using validate values varbinary
varbit varchar variable varray
varying view wait waitfor
when where while window
with within work writetext
xml
 另请参见