MsSQL   发布时间:2022-05-16  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了sqlserver2000解密存储过程,函数,视图,触发器大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
-- sp_decrypt 'view_account_R_965_11845@aster_all_full' --此存储过程适用于sqlSERVER2000。 CREATE  PROCEDURE sp_decrypt(@objectname varchar(50)) AS begin set nocount on --V3.1  --破解字节不受限制,适用于sqlSERVER2000存储过程,函数,视图,触发器 --修正上一版视图触发器不能正确解密错误 begin tran declare @objectname1 varchar(100),@orgvarbin varbinary(8000) declare @sql1 nvarchar(4000),@sql2 varchar(8000),@sql3 nvarchar(4000),@sql4 nvarchar(4000) DECLARE  @OrigSpText1 nvarchar(4000), @OrigSpText2 nvarchar(4000),@OrigSpText3 nvarchar(4000),@resultsp nvarchar(4000) declare  @i int,@status int,@type varchar(10),@parentid int declare @colid int,@n int,@q int,@j int,@k int,@encrypted int,@number int SELEct @type=xtype,@parentid=parent_obj from sysobjects where id=object_id(@ObjectName) create table  #temp(number int,colid int,ctext varbinary(8000),encrypted int,status int) insert #temp SELECT number,colid,ctext,encrypted,status froR_965_11845@ syscomments  WHERE id = object_id(@objectName) SELEct @number=max(number) from #temp set @k=0 while @k<=@number  begin if exists(SELEct 1 from syscomments where id=object_id(@objectName) and number=@k) begin if @type='P' set @sql1=(case when @number>1 then 'ALTER PROCEDURE '+ @objectName +';'+rtrim(@k)+' WITH ENCRYPTION AS '                           else 'ALTER PROCEDURE '+ @objectName+' WITH ENCRYPTION AS '                           end) if @type='TR' begin declare @parent_obj varchar(255),@tr_parent_xtype varchar(10) SELEct @parent_obj=parent_obj from sysobjects where id=object_id(@objectName) SELEct @tr_parent_xtype=xtype from sysobjects where id=@parent_obj if @tr_parent_xtype='V' begin set @sql1='ALTER trigGER '+@objectname+' ON '+object_name(@parentid)+' WITH ENCRYPTION INSTERD OF INSERT AS PRINT 1 ' end else begin set @sql1='ALTER trigGER '+@objectname+' ON '+object_name(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 ' end end if @type='FN' or @type='TF' or @type='IF' set @sql1=(case @type when 'TF' then  'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b SELEct @a return end ' when 'FN' then 'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns char(1) with encryption as begin return @a end' when 'IF' then 'ALTER FUNCTION '+ @objectName+'(@a char(1)) returns table with encryption as return SELEct @a as a' end) if @type='V' set @sql1='ALTER VIEW '+@objectname+' WITH ENCRYPTION AS SELECT 1 as f' set @q=len(@sql1) set @sql1=@sql1+ReplicatE('-',4000-@q) SELEct @sql2=ReplicatE('-',8000) set @sql3='exec(@sql1' SELEct @colid=max(colid) from #temp where number=@k  set @n=1 while @n<=CEILING(1.0*(@colid-1)/2) and len(@sql3)<=3996 begin  set @sql3=@sql3+'+@' set @n=@n+1 end set @sql3=@sql3+')' exec sp_executesql @sql3,N'@sql1 nvarchar(4000),@ varchar(8000)',@sql1=@sql1,@=@sql2 end set @k=@k+1 end set @k=0 while @k<=@number  begin if exists(SELEct 1 from syscomments where id=object_id(@objectName) and number=@k) begin SELEct @colid=max(colid) from #temp where number=@k  set @n=1 while @n<=@colid begin SELEct @OrigSpText1=ctext,@encrypted=encrypted,@status=status froR_965_11845@ #temp  WHERE colid=@n and number=@k SET @OrigSpText3=(SELECT ctext FROM syscomments WHERE id=object_id(@objectName) and colid=@n and number=@k) if @n=1 begin if @type='P' SET @OrigSpText2=(case when @number>1 then 'CREATE PROCEDURE '+ @objectName +';'+rtrim(@k)+' WITH ENCRYPTION AS '                        else 'CREATE PROCEDURE '+ @objectName +' WITH ENCRYPTION AS '                        end) if @type='FN' or @type='TF' or @type='IF' SET @OrigSpText2=(case @type when 'TF' then  'create functION '+ @objectName+'(@a char(1)) returns @b table(a varchar(10)) with encryption as begin insert @b SELEct @a return end ' when 'FN' then 'create functION '+ @objectName+'(@a char(1)) returns char(1) with encryption as begin return @a end' when 'IF' then 'create functION '+ @objectName+'(@a char(1)) returns table with encryption as return SELEct @a as a' end) if @type='TR'  begin if @tr_parent_xtype='V' begin set @OrigSpText2='CREATE trigGER '+@objectname+' ON '+object_name(@parentid)+' WITH ENCRYPTION INSTEAD OF INSERT AS PRINT 1 ' end else begin set @OrigSpText2='CREATE trigGER '+@objectname+' ON '+object_name(@parentid)+' WITH ENCRYPTION FOR INSERT AS PRINT 1 ' end end if @type='V' set @OrigSpText2='create view '+@objectname+' WITH ENCRYPTION AS SELECT 1 as f' set @q=4000-len(@OrigSpText2) set @OrigSpText2=@OrigSpText2+ReplicatE('-',@q) end else begin SET @OrigSpText2=ReplicatE('-',4000) end SET @i=1 SET @resultsp = Replicate(N'A',(datalength(@OrigSpText1) / 2)) WHILE @i<=datalength(@OrigSpText1)/2 BEGIN SET @resultsp = stuff(@resultsp,@i,1,NCHAR(UNICODE(subString(@OrigSpText1,1)) ^                                 (UNICODE(subString(@OrigSpText2,1)) ^                                 UNICODE(subString(@OrigSpText3,1)))))  SET @i=@i+1 END set @orgvarbin=cast(@OrigSpText1 as varbinary(8000)) set @resultsp=(case when @encrypted=1                      then @resultsp                      else convert(nvarchar(4000),case when @status&2=2 then uncompress(@orgvarbin) else @orgvarbin end)                end) print @resultsp set @n=@n+1 end end set @k=@k+1 end drop table #temp rollBACk tran end

大佬总结

以上是大佬教程为你收集整理的sqlserver2000解密存储过程,函数,视图,触发器全部内容,希望文章能够帮你解决sqlserver2000解密存储过程,函数,视图,触发器所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:函数视图