select * into newTableName from oldTableName where .....
select * into newTableNaem from ( select 1 , '01' union select 2 , '02' union select 3 , '03' union select 4 , '01' union select 5 , '02' union select 6 , '03' union select 7 , '01' union select 8 , '02' union select 9 , '04' union select 10 , '05' )
--如果接受数据导入的表已经存在 insert into 表 select * from tablename --如果导入数据并生成表 select * into 表 from tablename
select * into newTableName from oldTableName
Insert Into 生成一个新表不行,要用select Into
MD. 我用的 FireBird 不支持 Select into
if(表存在) begin insert 表名 select ... end else begin create table 表名 insert 表名 select ... endg
if(表存在) begin insert 表名 select ... end else begin create table 表名 insert 表名 select ... endg
if exists (select table_name from information_schema where table_name='tabname')---判断表是否存在 drop table tabname else begin create table tabname insert tabname select [被导入的表] where condition end
from
(
select 1 , '01'
union select 2 , '02'
union select 3 , '03'
union select 4 , '01'
union select 5 , '02'
union select 6 , '03'
union select 7 , '01'
union select 8 , '02'
union select 9 , '04'
union select 10 , '05'
)
insert into 表 select * from tablename
--如果导入数据并生成表
select * into 表 from tablename
begin
insert 表名 select ...
end
else
begin
create table 表名
insert 表名 select ...
endg
begin
insert 表名 select ...
end
else
begin
create table 表名
insert 表名 select ...
endg
(select table_name from information_schema where table_name='tabname')---判断表是否存在
drop table tabname
else
begin
create table tabname
insert tabname
select [被导入的表]
where condition
end