电脑触摸板右键是什么:asp中关键字问题求救!~

来源:百度文库 编辑:高校问答 时间:2024/05/09 07:17:52
你看这句:
sql="select userid,username from [users] order by userid desc
里面的 users 加了括号!~说是因为他是关键字,但我看了很多asp的源文件,有时这些关键字又不需要加中括号,到底什么时候要中括号,什么时候不要?象这样的关键字到底有哪些??
我问的重点是:
有时这些关键字又不需要加中括号,到底什么时候要中括号,什么时候不要?

给你所有的SQL关键字参考,如果有其他非官方数据库扩展,请查阅相关数据库文档,这些都需要你加[]如果能不用做字段名最好不用,在给数据库、字段等起名子的时候一定不要用以下这些词,虽然有的时候可能没有关系,但是为了避免麻烦还是不用为好。最好的办法起名子的时候都用前缀+拼音(如果不给外国人看的话)
active
add
all
after
alter
and
any
as
asc
ascending
at
auto
autoinc
avg
before
begin
between
blob
boolean
both
by
bytes
cache
cast
char
character
check
collate
column
commit
committed
computed
conditional
constraint
containing
count
create
cstring
current
cursor
database
date
day
dec
decimal
declare
default
delete
desc
descending
distinct
do
domain
double
drop
else
exists
external
extract
file
filter
float
for
foreign
from
full
function
grant
group
having
hour
if
in
int
inactive
index
inner
insert
integer
into
is
join
key
length
locks
logfile
long
lower
leading
left
level
like
manual
memory
merge
message
min
minute
money
month
names
national
natural
no
nocase
not
null
numeric
of
on
only
option
or
order
outer
page
pages
parameter
password
plan
position
precision
procedure
protected
primary
privileges
real
references
revoke
right
rollback
second
select
set
shared
shadow
schema
size
smallint
some
sort
sqlcode
starting
starts
statistics
substring
sum
table
then
time
timestamp
to
trailing
transaction
trigger
trim
union
unique
update
upper
user
value
values
varchar
variable
varying
view
when
where
while
with
work
write
year

1、首先你说的关键字问题是SQL语句中,即SQL的关键字,非ASP!

2、凡SQL关键字出现在SQL语句中必须加[],没有可加可不加的说法;

3、凡事你说可加可不加的肯定不是SQL的关键字,像"users"这个我印象中不是!

4、sql的关键字参照SQL SERVER联机帮助!其实我们以后在表或列命名时以ab_cdef,这样的格式命名不就用考虑会与关键字重复了。

如果不加[]可以运行,那就不加,
如果运行出错了,那加上,
不是每个人都记得住所有的关键字,
出错了,能想起来,可能是没加这个东西就可以了

关键字列表,请到我的BLOG查看:

http://sjcatsoft.cnblogs.com/archive/2005/12/02/288964.html

关键字必需加,非关键字也可加,这样的关键字多啊,其实不用死记,你觉得在程序中有特定意思的就把他当关键字处理得了,比如SQL ,from, order,^^^

带[]的是SQLSERVER的关键字。建议你看下SQLSERVER联机帮助