SQL キーワードには「予約語」として定義されているものがあります。SQL 文で予約語を識別子として使用するには、二重引用符、角カッコ、または逆引用符で囲みます。SQL 文で使用するキーワードは、すべてではありませんが多くが予約語になっています。たとえば、次の構文を使用して、SELECT テーブルの内容を取り出します。
SELECT * FROM "SELECT" |
SQL キーワードは大文字と小文字が区別されず、次の各語は大文字、小文字、またはその任意の組み合わせで使用されます。次の語のいずれかと、大文字/小文字の区別のみが違う文字列はすべて予約語となります。
また、non_keywords オプションを使用してキーワードをオフにすることもできます。
reserved_keywords オプションは、デフォルトで無効にされている個別のキーワードを有効にします。
Embedded SQL を使用している場合、データベースライブラリ関数 sql_needs_quotes を使用すると文字列に二重引用符が必要かどうかを判別できます。文字列が予約語であるか、または通常識別子に使用できない文字が含まれている場合は、文字列に二重引用符を付けます。
sa_reserved_words システムプロシージャーを使用すると、予約語のリストを取得できます。
SQL Anywhere で予約語になっている SQL キーワードは次のとおりです。
add | all | alter | and |
any | 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 | 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 | privileges | |
proc | procedure | publication | raiserror |
readtext | real | reference | references |
refresh | release | remote | remove |
rename | reorganize | resource | restore |
restrict | return | revoke | right |
rollback | rollup | 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 | unsigned |
update | updating | user | using |
validate | values | varbinary | varbit |
varchar | variable | varying | view |
wait | waitfor | when | where |
while | window | with | within |
work | writetext | xml |
![]() |
DocCommentXchange で意見交換できます
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |