日期:2014-05-17 浏览次数:20519 次
ALTER proc [dbo].[usp_rpt_calllist_department] @mth varchar(100),@dep varchar(100) as declare @SQL varchar(8000) create table #1(mth varchar(20) not null,compid varchar(10) null ,depname varchar(20) not null,zhf numeric(18,2) null) insert #1 select mth,compid,depname,sum(mtotal) as total from call_list group by mth,compid,depname set @sql=' select * from #1 where mth in (' + @mth + ') and depname in ('+@dep+')' print @sql exec (@sql) drop table #1