本文介绍一些有用的MSSQL语句,虽然简单,但很实用,供需要时参考。1、添加主键 alter table [tablename] add primary key(col1)2、删除主键 alter table [tablename] drop primary key(col1)3、创建索引 create unique index [idxname] on [tablename](col1,col2)4、删除索引 drop index [idxname] 索引不能更改,只能删除后再重建5、union运算 union运算符通过组合其他两个结果表(如 table1 和 table2)并消去表中任何重复行而派生出一个结果表。当 all 随 union 一起使用时(即 union all),不消除重复行。6、except运算 except运算符通过包括所有在 table1 中但不在 table2 中
lg...