SQL Serverの予約語に苦しめられる
こんにちは。最近SQLサーバーをPHPでいじる機会が増えたんですが、その時いくら見直してもおかしいところが無い時、結局おかしかったのは(なぜか)予約語を使ってるのが原因だったり、色々と苦しめられました。
それを鑑みて一度予約語をまとめておきます。以下はOracle SQLとMicrosoft SQLのいずれかで予約語として指定されているワード一覧です。ここに記載されている予約語はいずれかで予約語として使われているので、どういった場面でも使用するのは望ましくないです。(スマホで閲覧する場合は、テーブルが横にもスクロールします。)
absolute | dec | long | smallint |
access | decimal | longbinary | smallint |
add | declare | longchar | smallmoney |
add | default | longtext | some |
admindb | delete | lower | space |
all | delete | match | sql |
all | desc | max | sqlcode、sqlerror、sqlstate |
alphanumeric | disallow | maxextents | start |
alter | disconnect | memo | stdev |
alter | distinct | min | stdevp |
alter | distinctrow | minus | string |
and | domain | minute | substring |
any | double | mlslabel | successful |
are | drop | mod | sum |
as | else | mode | synonym |
as | eqv | modify | sysdate |
asc | exclusive | money | sysname |
assertion | exclusiveconnect | month | system_user |
audit | exec、execute | national | table |
authorization | exists | nchar | tableid |
autoincrement | extract | nested_table_id | temporary |
avg | false | noaudit | text |
begin | fetch | nocompress | then |
between | file | nonclustered | time |
binary | first | not | timestamp |
bit | float、float8 | nowait | timezone_hour |
bit_length | float4 | ntext | timezone_minute |
boolean | for | null | tinyint |
both | foreign | number | to |
by | from | numeric | top |
byte | general | nvarchar | trailing |
cascade | grant | octet_length | transaction |
catalog | group | of | transform |
char | guid | offline | translate |
char、character | having | oleobject | translation |
char_length | hour | on | trigger |
character_length | identified | online | trim |
check | identity | open | true |
close | ieeedouble | option | uid |
cluster | ieeesingle | or | union |
clustered | ignore | or | unique |
coalesce | image | order | uniqueidentifier |
collate | immediate | pctfree | unknown |
collation | imp | prior | update |
column | in | privileges | updateidentity |
column_value | increment | public | updateowner |
comment | index | raw | updatesecurity |
commit | indexcreatedb | real | upper |
comp | initial | references | usage |
compress | inner | rename | user |
connect | input | resource | using |
connection | insensitive | restrict | validate |
constraint、constraints | insert | revoke | value |
container | int、integer、integer4 | right | values |
contains | integer | rollback | var |
convert | integer1 | row | varbinary |
count | integer2 | rowid | varchar |
counter | intersect | rownum | varchar2 |
create | interval | rows | varp |
create | into | schema | varying |
currency | is | second | view |
current | isolation | select | when |
current_date | join | selectschema | whenever |
current_time | key | selectsecurity | where |
current_timestamp | language | session | with |
current_user | last | set | work |
cursor | left | share | xor |
database | level | short | year |
date | like | single | yesno |
datetime | lock | size | zone |
day | logical、logical1 | smalldatetime |
以上238個の予約語でした。想像以上にあって困ったものです。これは適当にやってても引っかかりますわ・・・みなさんもお気をつけて。
投稿者プロフィール
最新の投稿
- 2018.09.01AMD動画エンコードでGPUを活用する
- 2018.03.26phpツイートIDからsnowflakeを用いて投稿時刻のミリ秒を算出
- 2018.02.18phpphpMyAdminのインストール方法(Ubuntu)
- 2018.01.07未分類新聞を折らずに郵送する方法
最近のコメント