Reserved words

Some keywords in SQL are also reserved words. To use a reserved word in a SQL statement as an identifier, you must enclose the word in double quotes. Many, but not all, of the keywords that appear in SQL statements are reserved words. For example, you must use the following syntax to retrieve the contents of a table named SELECT.

SELECT * 
FROM "SELECT"

Because SQL is not case sensitive with respect to keywords, each of the words in Table 3-1 may appear in uppercase, lowercase, or any combination of the two. All strings that differ only in capitalization from these words are reserved words.

If you are using Embedded SQL, you can use the database library function sql_needs_quotes to determine whether a string requires quotation marks. A string requires quotes if it is a reserved word or if it contains a character not ordinarily allowed in an identifier.

Table 3-1 lists the SQL reserved words in Sybase IQ.

Table 3-1: SQL reserved words

active

add

all

algorithm

alter

and

any

append

as

asc

auto

backup

begin

between

bigint

binary

bit

bottom

break

by

calibrate

calibration

call

cancel

capability

cascade

case

cast

certificate

char

char_convert

character

check

checkpoint

checksum

clientport

close

columns

comment

commit

committed

comparisons

computes

conflict

connect

constraint

contains

continue

convert

create

cross

cube

current

current_timestamp

current_user

cursor

date

dbspace

dbspacename

deallocate

debug

dec

decimal

declare

decoupled

decrypted

default

delay

delete

deleting

density

desc

deterministic

disable

distinct

do

double

drop

dynamic

elements

else

elseif

enable

encapsulated

encrypted

end

endif

escape

except

exception

exclude

exec

execute

existing

exists

explicit

express

externlogin

fastfirstrow

fetch

first

float

following

for

force

foreign

forward

from

full

gb

goto

grant

group

grouping

having

hidden

history

holdlock

identified

if

in

inactive

index

index_lparen

inner

inout

input

insensitive

insert

inserting

install

instead

int

integer

integrated

intersect

into

iq

is

isolation

jdk

join

kb

key

lateral

left

like

lock

logging

login

long

mb

match

membership

message

mode

modify

namespace

natural

new

no

noholdlock

nolock

not

notify

null

numeric

of

off

on

open

optimization

option

options

or

order

others

out

outer

over

pages

paglock

partial

partition

passthrough

password

plan

preceding

precision

prepare

primary

print

privileges

proc

procedure

proxy

publication

raiserror

range

raw

readcommitted

readonly

readpast

readtext

readuncommitted

readwrite

real

recursive

reference

references

release

relocate

remote

remove

rename

reorganize

repeatable

repeatableread

reserve

resizing

resource

restore

restrict

return

revoke

right

rollback

rollup

root

row

rowlock

rows

save

savepoint

schedule

scroll

secure

select

sensitive

serializable

service

session

set

setuser

share

smallint

soapaction

some

space

sqlcode

sqlstate

start

stop

subtrans

subtransaction

synchronize

syntax_error

table

tablock

tablockx

tb

temporary

then

ties

time

timestamp

tinyint

to

top

tran

transaction

transactional

transfer

tries

trigger

truncate

tsequal

unbounded

uncommitted

union

unique

uniqueidentifier

unknown

unsigned

update

updating

updlock

url

user

utc

using

validate

values

varbinary

varchar

variable

varying

virtual

view

wait

waitfor

web

when

where

while

window

with

withauto

with_cube

with_lparen

with_rollup

within

word

work

writeserver

writetext

xlock

xml