sql枢轴表缓慢

时间:2019-05-14 07:17:58

标签: sql performance pivot-table

我如何才能非常缓慢地加速此代码

create  table #a(r_sayac varchar(120),i3 nvarchar(120),i4 varchar(120),i5 varchar(120),i6 varchar(120),i7  varchar(120),i8 varchar(120) )
insert #a 
select sbss.r_sayac,sbss.i3,sbss.i4,sbss.i5,sbss.i6,sbss.i7,sbss.i8 
from dbo.table1 sbss


update #a  set #a.i3=mtib.i_anlami   from #a,dbo.table2 mtib where #a.i3=mtib.i_rsayac
update #a  set #a.i4=mtib.i_anlami   from #a,dbo.table2 mtib where #a.i4=mtib.i_rsayac
update #a  set #a.i5=mtib.i_anlami   from #a,dbo.table2 mtib where #a.i5=mtib.i_rsayac
update #a  set #a.i6=mtib.i_anlami   from #a,dbo.table2 mtib where #a.i6=mtib.i_rsayac
update #a  set #a.i7=mtib.i_anlami   from #a,dbo.btable2 mtib where #a.i7=mtib.i_rsayac
update #a  set #a.i8=mtib.i_anlami   from #a,dbo.table2 mtib where #a.i8=mtib.i_rsayac

0 个答案:

没有答案