大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> 数据库 -> 如何批量加密存储过程?

如何批量加密存储过程?

时间: 2021-07-31 作者:daque

--援用http://www.microsoft.com/china/technet/columns/tipsfortechs/wsqs3.asp 归纳范例 底下给出了一个保存进程,它的效率是机动将暂时数据库的用户保存进程加密。declare @sp_name nvarchar(400)declare @sp_content nvarchar(2000)declare @asbegin intdeclare @now datetimeselect @now = getdate()declare sp_cursor cursor for select object_name(id)from sysobjectswhere xtype = 'p' and type = 'p' and crdate < @nowand objectproperty(id, 'ismsshipped')=0open sp_cursorfetch next from sp_cursor into @sp_namewhile @@fetch_status = 0beginselect @sp_content = text from syscomments where id = object_id(@sp_name) select @asbegin = patindex ( '%as' + char(13) + '%', @sp_content) select @sp_content = substring(@sp_content, 1, @asbegin - 1) + ' with encryption as'+ substring (@sp_content, @asbegin+2, len(@sp_content))select @sp_name = 'drop procedure [' + @sp_name + ']'exec sp_executesql @sp_name exec sp_executesql @sp_contentfetch next from sp_cursor into @sp_nameendclose sp_cursor deallocate sp_cursor该保存进程运用了 sysobjects 和 syscomments 表,并精巧地窜改了原保存进程的 sql 设置语句,将 as 窜改为了 with encryption as,进而到达了加密保存进程的手段。本保存进程在 sql server 2000 上经过。

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.