--创建学生表
create table student
(
sname char(8),
sno char(6),
sbirthday datetime,
)
go
--修改表
--alter table 表名 alter column 列名 数据类型 是否为空
alter table student alter column sname char(4) not null
alter table student alter column sno char(12) not null
alter table student alter column sname int not null
alter table student alter column sbirthday char(10) not null
--修改列名
--exec sp_rename '表名.原列名' ,'修改后的列名','column'
--一般不要修改列名,慎用
exec sp_rename 'student.sno','no','column'
--删除列
--alter table 表名 drop column 列名
alter table student drop column no
--添加列
--alter table 表名 add 列名 数据类型 是否为空
alter table student add ssex char(2) not null