当前位置: 数据库>sqlserver
select into与insert into的示例代码
来源: 互联网 发布时间:2014-08-29
本文导语: 本节内容: select into 与 insert into的例子 1,SQL Server: 代码示例: select * into Table2 from Table1; Insert into Table2(field1,field2,...) select value1,value2,... from Table1; 2,Oracle: 代码示例: create table Table2 as select * from Table1; insert into Table2...
本节内容:
select into 与 insert into的例子
1,SQL Server:
代码示例:
select * into Table2 from Table1;
Insert into Table2(field1,field2,...) select value1,value2,... from Table1;
Insert into Table2(field1,field2,...) select value1,value2,... from Table1;
2,Oracle:
代码示例:
create table Table2 as select * from Table1;
insert into Table2 values select * from Table1;
insert into Table2 values select * from Table1;
3,mysql数据库:
代码示例:
Create table new_table_name (Select * from old_table_name);
Insert into Table2(field1,field2,...) select value1,value2,... from Table1;
Insert into Table2(field1,field2,...) select value1,value2,... from Table1;
例子:
代码示例:
--备份表数据
create table uc_dict_bak (select * from uc_dict);
--删除原表数据
delete from uc_dict;
-- by www.
--将备份数据还原至原表
insert into uc_dict (select * from uc_dict_bak);
create table uc_dict_bak (select * from uc_dict);
--删除原表数据
delete from uc_dict;
-- by www.
--将备份数据还原至原表
insert into uc_dict (select * from uc_dict_bak);