可以写成 insert 表名1 (字段1,字段2...) select 字段1,字段2... from 表名2 where 条件
比如: insert into cw_kmye (zth,cwyf,kmdm,ncye,qcye,jf_month,df_month,jf_year,df_year) select :g_cw_zth,:cwyf,kmdm,0,0,0,0,0,0 from cw_kmdm where zth=:g_cw_zth ;
create table #mike(no int identity(1,1) not null primary key,password varchar (4))insert into #mike(password) select password from 另一个表
不是,实际上往一个临时表上加入数据。它的来源是select 语句的结果。
Try: select password into #mike from 另一个表select * from #mike
create table #mike(no int identity(1,1) not null primary key,password varchar (4))insert into #mike(password) select password from 另一个表
insert 表名1 (字段1,字段2...)
select 字段1,字段2... from 表名2
where 条件
insert into cw_kmye (zth,cwyf,kmdm,ncye,qcye,jf_month,df_month,jf_year,df_year)
select :g_cw_zth,:cwyf,kmdm,0,0,0,0,0,0 from cw_kmdm
where zth=:g_cw_zth ;
create table #mike(no int identity(1,1) not null primary key,password varchar (4))insert into #mike(password)
select password from 另一个表
select password into #mike from 另一个表select * from #mike