日期:2014-05-17 浏览次数:20701 次
create table #temp1(
CLBH varchar(10),
CLLX varchar(10),
CLMC varchar(10),
CLDW varchar(10),
CLGG varchar(10)
)
insert into #temp1
select 'A0001','双粉','128金东','R','1194*787' union all
select 'A0002','哑粉','128金东','R','1194*787' union all
select 'A0003','双粉','128金东','R','1194*787'
create table #temp2(
CLBH varchar(10),
XMMC varchar(10),
FValue varchar(10)
)
insert into #temp2
select 'A0001','CLLX','' UNION ALL
select 'A0001','CLMC','' UNION ALL
select 'A0001','CLDW','' UNION ALL
select 'A0001','CLGG','' UNION ALL
select 'A0002','CLLX','' UNION ALL
select 'A0002','CLMC','' UNION ALL
select 'A0002','CLDW','' UNION ALL
select 'A0002','CLGG','' UNION ALL
select 'A0003','CLLX','' UNION ALL
select 'A0003','CLMC','' UNION ALL
select 'A0003','CLDW','' UNION ALL
select 'A0003','CLGG',''
INSERT INTO 表3 (CLBH,XMMC,FVALUE)
select CLBH,XMMC=‘CLLX’,FVALUE=CLLX
from #TEMP1
INSERT INTO 表3 (CLBH,XMMC,FVALUE)
select CLBH,XMMC=‘CLMC’,FVALUE=CLMC
from #TEMP1
......
create table temp1(
CLBH varchar(10),
CLLX varchar(10),
CLMC varchar(10),
CLDW varchar(10),
CLGG varchar(10)
)
insert into temp1
select 'A0001','双粉','128金东','R','1194*787' union all
select 'A0002','哑粉','128金东','R','1194*787' union all
select 'A0003','双粉','128金东','R','1194*787'
declare @sql