--增加一列Emgr(负责人)--
Alter Table employee
ADD emgr char(4) null;
--修改Emgr的数据类型为char(10)--
Alter Table employee
ALTER column emgr char(10);
--删除emgr--
Alter Table employee
DROP column emgr;
--增加Ename必须取唯一值的约束条件--
Alter Table employee
ADD constraint UQ_Ename unique(Ename);--用户为该唯一值约束设定约束名UQ_Ename--
--或者--
Alter Table employee
ADD unique(ename);
--增加title的默认值为“助工”--
Alter Table employee
add constraint df_title default '助工' for title;
--删除完整性条件UQ_Ename--
Alter Table employee
drop constraint UQ_Ename;
--将表Employee2重命名为Emp--
EXEC sp_rename 'Employee2','Emp';
--将Emp中的列Employee name重命名为Ename--
EXEC sp_rename 'Emp.[Employee name]','Ename','column'

被折叠的 条评论
为什么被折叠?



