道与魔:SqlServer存储过程函数加解密

道与魔:SqlServer存储过程函数加解密,第1张

  存储过程 存储函数的加密 WITH ENCRYPTION  <! [if !supportLineBreakNewLine] >  <! [endif] >    CREATE procedure dbo sp_XML_main    @table_name nvarchar( )=   @dirname nvarchar( )=   WITH ENCRYPTION    as    begin       end    go    存储过程 存储函数的解密(以下是一位绝世高人编写的代码)    if exists (select from dbo sysobjects where id = object_id(N [dbo] [sp_decrypt] ) and OBJECTPROPERTY(id N IsProcedure ) = )    drop procedure [dbo] [sp_decrypt]    GO    / 破解函数 过程 触发器 视图 仅限于SQLSERVER    作者:J All rights reserved/    / 调用示例     解密指定存储过程    exec sp_decrypt AppSP_test    对所有的存储过程解密    declare tb cursor for    select name from sysobjects where xtype= P and status> and name<> sp_decrypt   declare @name sysname    open tb    fetch next from tb into @name    while @@fetch_status=   begin    print / 存储过程 [ +@name+ ] /   exec sp_decrypt @name    fetch next from tb into @name    end    close tb    deallocate tb     /    if exists (select from dbo sysobjects where id = object_id(N [dbo] [SP_DECRYPT] ) and OBJECTPROPERTY(id N IsProcedure ) = )    drop procedure [dbo] [SP_DECRYPT]    GO    CREATE PROCEDURE sp_decrypt(@objectName varchar( ))    AS    begin    set nocount on     破解字节不受限制 适用于SQLSERVER 存储过程 函数 视图 触发器     修正上一版视图触发器不能正确解密错误     发现有错 请E_MAIL   begin tran    declare @objectname varchar( ) @varbin varbinary( )    declare @sql nvarchar( ) @sql varchar( ) @sql nvarchar( ) @sql nvarchar( )    DECLARE @OrigSpText nvarchar( ) @OrigSpText nvarchar( ) @OrigSpText nvarchar( ) @resultsp nvarchar( )    declare @i int @status int @type varchar( ) @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( ) encrypted int status int)    insert #temp SELECT number colid ctext encrypted status FROM sy ents WHERE id = object_id(@objectName)    select @number=max(number) from #temp    set @k=   while @k<=@number    begin    if exists(select from sy ents where id=object_id(@objectname) and number=@k)    begin    if @type= P   set @sql =(case when @number> 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( ) @tr_parent_xtype varchar( )    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 @sql = ALTER TRIGGER +@objectname+ ON +OBJECT_NAME(@parentid)+ WITH ENCRYPTION INSTERD OF INSERT AS PRINT   end    else    begin    set @sql = ALTER TRIGGER +@objectname+ ON +OBJECT_NAME(@parentid)+ WITH ENCRYPTION FOR INSERT AS PRINT   end    end    if @type= FN or @type= TF or @type= IF   set @sql =(case @type when TF then     ALTER FUNCTION + @objectName+ (@a char( )) returns @b table(a varchar( )) with encryption as begin insert @b select @a return end   when FN then     ALTER FUNCTION + @objectName+ (@a char( )) returns char( ) with encryption as begin return @a end   when IF then     ALTER FUNCTION + @objectName+ (@a char( )) returns table with encryption as return select @a as a   end)    if @type= V   set @sql = ALTER VIEW +@objectname+ WITH ENCRYPTION AS SELECT as f   set @q=len(@sql )    set @sql =@sql +REPLICATE( @q)    select @sql =REPLICATE( )    set @sql = exec(@sql   select @colid=max(colid) from #temp where number=@k    set @n=   while @n<=CEILING( (@colid )/ ) and len(@sQL )<=   begin    set @sql =@sql + +@   set @n=@n+   end    set @sql =@sql + )   exec sp_executesql @sql N @sql nvarchar( ) @ varchar( ) @sql =@sql @=@sql   end    set @k=@k+   end    set @k=   while @k<=@number    begin    if exists(select from sy ents where id=object_id(@objectname) and number=@k)    begin    select @colid=max(colid) from #temp where number=@k    set @n=   while @n<=@colid    begin    select @OrigSpText =ctext @encrypted=encrypted @status=status FROM #temp WHERE colid=@n and number=@k    SET @OrigSpText =(SELECT ctext FROM sy ents WHERE id=object_id(@objectName) and colid=@n and number=@k)    if @n=   begin    if @type= P   SET @OrigSpText =(case when @number> 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 @OrigSpText =(case @type when TF then     CREATE FUNCTION + @objectName+ (@a char( )) returns @b table(a varchar( )) with encryption as begin insert @b select @a return end   when FN then     CREATE FUNCTION + @objectName+ (@a char( )) returns char( ) with encryption as begin return @a end   when IF then     CREATE FUNCTION + @objectName+ (@a char( )) returns table with encryption as return select @a as a   end)    if @type= TR   begin    if @tr_parent_xtype= V   begin    set @OrigSpText = CREATE TRIGGER +@objectname+ ON +OBJECT_NAME(@parentid)+ WITH ENCRYPTION INSTEAD OF INSERT AS PRINT   end    else    begin    set @OrigSpText = CREATE TRIGGER +@objectname+ ON +OBJECT_NAME(@parentid)+ WITH ENCRYPTION FOR INSERT AS PRINT   end    end    if @type= V   set @OrigSpText = CREATE VIEW +@objectname+ WITH ENCRYPTION AS SELECT as f   set @q= len(@OrigSpText )    set @OrigSpText =@OrigSpText +REPLICATE( @q)    end    else    begin    SET @OrigSpText =REPLICATE( )    end    SET @i=   SET @resultsp = replicate(N A (datalength(@OrigSpText ) / ))    WHILE @i<=datalength(@OrigSpText )/   BEGIN    SET @resultsp = stuff(@resultsp @i NCHAR(UNICODE(substring(@OrigSpText @i )) ^ lishixinzhi/Article/program/SQLServer/201311/21965

监听配置:

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

)

)

我的Oracle监听及tnsnamesora所在目录:C:\app\Administrator\product\1110\db_1\NETWORK\ADMIN

存储过程可以 你就建存储过程呗

你这个 报错很明显 函数 不让你这么干

在函数内对带副作用的运算符 'SELECT INTO' 的使用无效。

你换个招试试

比如 select count()=@v_count as dd from khn_configgroup where config_id=@template_id and group_id=@group_id;

sqlsever函数变量如何赋值我也不是很清楚 没用过

或者用 set let

可以用VBA代码编写自定义函数,它与VB非常相似,很多代码可以直接互用。

你可以百度一下,看看本人的百度空间文章,上有你需要的例子

搜索关键字:

VB(VBA)编写人民币大写转换函数及应用实例

trunc(45923,1) 按指定精度截断十进制数 结果:459 此为oracle函数

mod(1600,300) 求除法余数 结果:100

abs(numeric_expr) 求绝对值

ceiling(numeric_expr) 取大于等于指定值的最小整数

avg(numeric_expr)取平均数

exp(float_expr) 取指数

floor(numeric_expr) 小于等于指定值得最大整数

pi() 31415926

power(numeric_expr,power) 返回power次方

rand([int_expr]) 随机数产生器

round(numeric_expr,int_expr) 安int_expr规定的精度四舍五入

sign(int_expr) 根据正数,0,负数,,返回+1,0,-1

sqrt(float_expr) 平方根

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/12177530.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-21
下一篇2023-05-21

发表评论

登录后才能评论

评论列表(0条)

    保存