3.多行一条语句插入多行 insert into 表名 ([列1],[列2]) select "值1","值2" union all --这里呢,union 和 union all的 区别 --主要是对于重复值得处理,union 会过滤掉重复行,而union all会全插进去 select "值3","值4" union select "值5","值6"
4.复制到新表 将原有表中的数据复制到一个不存在的新表中 select * into newtable from oldtable --仅复制表结构如何做呢? select * into newtable from oldtable where 1<>1 select top 0 * into newtable from oldtable
5.插入其他表的数据 向一个已有表中,复制其他表的数据 insert into tablename(column,column2) select column,column2 from oldtable
--1)开启添加,(解除添加的限制) Set indentity_insert tablename On --2)可以手动插入id了 insert into 表明 (id,name) values ("1002","大二") --3)关闭手动插入 Set indentity_insert tablename off