多个存储过程共用一个存储过程名且用分号分开区别,每个存储过程加密
则不易被sp__windbi$decrypt破解
如:
--Drop PROC [dbo].[SP_MFSP_CUSTQUERY_108]
--浮动幅度防盗锁反对大幅度司法
Create PROC [dbo].[SP_MFSP_CUSTQUERY_109];1
(@VWHERE1 int,@VDate1 datetime,@VDate2 datetime)
with encryption
AS
GO
Create PROC [dbo].[SP_MFSP_CUSTQUERY_109];2
(@VWHERE1 int,@VDate1 datetime,@VDate2 datetime)
with encryption
AS
GO
Create PROC [dbo].[SP_MFSP_CUSTQUERY_109];3
(@VWHERE1 int,@VDate1 datetime,@VDate2 datetime)
with encryption
AS
GO
Create PROC [dbo].[SP_MFSP_CUSTQUERY_109];4
(@VWHERE1 int,@VDate1 datetime,@VDate2 datetime)
with encryption
AS
GO
Create PROC [dbo].[SP_MFSP_CUSTQUERY_109];5
(@VWHERE1 int,@VDate1 datetime,@VDate2 datetime)
with encryption
AS
declare @intDept int
declare @intOldDept int
declare @intCnt int
declare @strDept varchar(30)
declare @strSwitch varchar(7000),@strSql varchar(8000)
set @strSwitch = ''
set @intDept = 0
set @intOldDept = 0
--EXEC SP_MFSP_CUSTQUERY_108 :VWhere1,:VDate1,:VDate2
--EXEC SP_MFSP_CUSTQUERY_108 1,'2010-08-03','2010-11-28'
set nocount on
select data0017.rkey,inv_part_number,data0034.dept_ptr,a.dept_name,sum(quantity) as qty
Into #Tmp
from data0207 left join
data0034 on data0207.dept_ptr=data0034.rkey left join
data0034 a on a.rkey=data0034.dept_ptr left join
data0017 on data0017.rkey=data0207.inventory_ptr
Where data0207.ttype not in (3,4,5,6) --and tdate>='2010-01-01'
and datediff(dd,@VDate1,tdate ) >= 0 and datediff(dd,@VDate2,tdate ) <= 0
group by data0017.rkey,inv_part_number,data0034.dept_ptr,a.dept_name
order by data0017.rkey
select distinct dept_ptr,dept_name Into #TmpDept from #Tmp Order By dept_ptr,dept_name
set @intOldDept = @intDept
select top 1 @intDept = dept_ptr,@strDept = dept_name from #TmpDept
while @intDept > 0 and @intDept <> @intOldDept
begin
delete from #TmpDept Where dept_ptr = @intDept
--print 'intDept:' + str(@intDept) + ' -- strDept:' + @strDept
Set @strSwitch = @strSwitch +
' ,Sum(Case When Tmp.dept_ptr =' + ltrim(rtrim(str(@intDept))) + ' Then Tmp.Qty Else 0 End) As [' + @strDept + ']'
--=================================================================
set @intOldDept = @intDept
select top 1 @intDept = dept_ptr,@strDept = dept_name from #TmpDept
end
set @strSql = ''
set @strSql = 'Select Rkey,inv_part_number ' +
@strSwitch +
' From #Tmp Tmp ' +
' Group By Rkey,inv_part_number ' +
' Order By Rkey,inv_part_number '
--print @strSql
set nocount off
exec(@strSql)
set nocount on
Drop Table #Tmp
drop table #TmpDept
set nocount off
go
阅读(672) | 评论(0) | 转发(0) |