1.如果是整个表复制表达如下: insert into table1 select * from table2 2.如果是有选择性的复制数据表达如下: insert into table1(column1,column2,column3...) select column1,column2,colunm3... from table2 3.一个数据库中的表中的数据复制到另一个数据库中的一个表,使用方法如下: insert into 数据库A.dbo.table1(col1,col2,col3.
1,下面这句会把表2数据删除,然后把表1复制到表一,两表内容一样 SELECT * into 表2 FROM 表1 2,这句只追加,不删除表2的数据 insert into 表1 select * from 表2 转自:http://zhidao.baidu.com/question/300406948.html
1.表结构相同的表,且在同一数据库(如,table1,table2) Sql :insert into table1 select * from table2 (完全复制) insert into table1 select distinct * from table2(不复制重复纪录) insert into table1 select top 5 * from table2 (前五条纪录) 2. 不在同一数据库中(如,db1 table1,db2 table2) sql: insert in
select a.TABLE_SCHEMA,a.TABLE_NAME from information_schema.`COLUMNS` a left join (select 'etl_stamp' COLUMN_NAME ) b on a.COLUMN_NAME=b.COLUMN_NAME left join information_schema.STATISTICS c on a.TABLE_SCHEMA=c.TABLE_SCHEMA and a.TABLE_NAME=c.TABLE_NA
create or replace function isExist(data in DataTypes) --DataTypes 为表中该数据的类型return Numberisv_flag number(2);v_data [DataTypes]; --表中数据的类型beginselect data into v_data from table_name where ....;if v_data not null then v_falg := 1;else v_flag :=0;end if