日期:2014-05-16 浏览次数:20482 次
create procedure KeyWordFind
@condition varchar(2000),--查找条件
@time1 varchar(12),--时间一
@time2 varchar(12)--时间2
as
begin
select sptm,sum(shul)as xs_shul,sum(xfje)as xs_zje from (select xsckmx.sptm,xsckmx.shul,xsckmx.xfje,keytable.keyword from SJZL_ERP_MD_XSCKMX as xsckmx,SJZL_ERP_MD_XSCKD as xsckd,(@condition) as keyTable where xsckmx.sptm=keyTable.sptm and xsckd.cancelcode!=1 and xsckmx.danh=xsckd.danh and (convert(varchar(10),xsckd.kdsj,120) between ''+@time1+'' and ''+@time2+''))as xs_heji group by sptm
end
create procedure KeyWordFind
@condition varchar(2000),--查找条件
@time1 varchar(12),--时间一
@time2 varchar(12)--时间2
as
begin
DECLARE @sql VARCHAR(max)
SET @sql='select sptm,sum(shul)as xs_shul,sum(xfje)as xs_zje from (select xsckmx.sptm,xsckmx.shul,xsckmx.xfje,keytable.keyword from SJZL_ERP_MD_XSCKMX as xsckmx,SJZL_ERP_MD_XSCKD as xsckd,('+@condition+') as keyTable where xsckmx.sptm=keyTable.sptm and xsckd.cancelcode!=1 and xsckmx.danh=xsckd.danh and (convert(varchar(10),xsckd.kdsj,120) between '''+@time1+''' and '''+@time2+'''))as xs_heji group by sptm'
exec (@sql)
end
CREATE CLUSTERED INDEX Clu_IX_SJZL_ERP_CKXX ON SJZL_ERP_CKXX(szqybm);
CREATE INDEX IX_SJZL_ERP_CKXX ON SJZL_ERP_CKXX(ckbm);
CREATE INDEX IX_SJZL_ERP_MD_SPFCKC ON SJZL_ERP_MD_SPFCKC(SPTM) INCLUDE (CKBM,SHUL);
CREATE INDEX IX_SJZL_ERP_KEYWORD ON SJZL_ERP_KEYWORD(SPTM);