alter table chat add " & Text1.Text & " int not null default 0
意思是添加一个字段,并设置为非空,默认值为0
但是我需要设置有效性规则,比如大于0,小于100
alter table chat add " & Text1.Text & " int not null check (>=0 and <=100) default 0 不对,该怎么改?
意思是添加一个字段,并设置为非空,默认值为0
但是我需要设置有效性规则,比如大于0,小于100
alter table chat add " & Text1.Text & " int not null check (>=0 and <=100) default 0 不对,该怎么改?
alter table TBName add ColumnName int not null check (ColumnName >=0 and ColumnName<=100) default 0
不行
不行
alter table tmp1 add myid2 int not null check (myid2>=1 and myid2<=100) default 0
alter table tmp1 add myid2 int not null check (myid2>=1 and myid2<=100) default 0
这个是可以的
报:字段定义语法错误。TO:clear_zero
alter table tmp1 add myid2 int not null default 0 这句可以,但alter table tmp1 add myid2 int not null check (myid2>=1 and myid2 <=100) default 0
不行,字段定义语法错误你试过没有?
dim s as string
s="alter table chat add " & Text1.Text & " int not null check (" & Text1.Text & " >=0 and " & Text1.Text & " <=100) default 0"
'输出检查:
debug.print s
alter table TB add Col int not null constraint Col_Name check (Col >=0 and Col<=100) default 0