51Testing软件测试论坛

标题: 关于修改表的操作问题 [打印本页]

作者: lovewings    时间: 2007-5-28 16:36
标题: 关于修改表的操作问题
再表里添加多个列能不能用一个ALTER TABLE的啊
比如
alter table lwl
add new1 int not null

aler table lwl
add new1 int not null

这两个命令并一起怎么写啊

alter table lwl
add new1 int not null
add new2 int not null


这样可以麽???
作者: hanjj    时间: 2007-5-29 15:54
不可以。一个add要对应一个alter,不能省略。
作者: dj    时间: 2007-5-29 17:48
不可以,

Alter table tabname add column col type
只能增加一个列
注:列增加后将不能删除。DB2中列加上后数据类型也不能改变,唯一能改变的是增加varchar类型的长度。
作者: zhangchen    时间: 2007-5-31 20:11
楼上的说的不对。
add和drop是可以在同一句“alter table”语句下同时对多个字段进行操作的,只有alter不能,需要分句写。
要实现LZ所说的,则
alter table lwl
add new1 int not null, new2 int not null





欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2