如何加密数据库的所有现有存储过程 [英] How to encrypt all existing stored procedures of a database

查看:190
本文介绍了如何加密数据库的所有现有存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想要做的原因是否有可能对SQL Server 2008数据库的所有现有存储过程进行加密?这是以下内容:

我想开发存储过程而不加密,所以我可以轻松点击SQL Server Management Studio中的修改来检查其内容。

但是,对于部署,我想加密它们,所以我认为也许我可以编写一个脚本,只有在它们创建之后加密它们。对于dev系统,我不会运行脚本,而在最终用户系统上将运行脚本。

解决方案

我有同样的问题。



我的解决方案是将 - WITH ENCRYPTION放在我所有的存储过程中。这个版本由开发人员使用并存储在源代码控制中。



然后,我在构建中使用一个工具(如sed)将WITH WITH ENCRYPTION替换为WITH对于纯SQL解决方案,您可以使用REPLACE。



Is there any possibility to encrypt all existing stored procedures of a SQL Server 2008 database AFTER they have been created via an SQLCMD script?

The reason I want to do this is the following:
I'd like to develop the stored procedures without encryption so I can easily click on "Modify" in SQL Server Management Studio to check their contents.
However, for the deployment I'd like to encrypt them so I thought that maybe I could write a script which encrypts them only after they're created. For dev systems I simply wouldn't run the script while on end-user systems the script would be run.

解决方案

I have the same problem.

My solution is to put "-- WITH ENCRYPTION" in all of my stored procedures. This version is used by developers and stored in source control.

I then use a tool (like sed) in my build to replace "-- WITH ENCRYPTION" with "WITH ENCRYPTION" on the files before I send them to be installed.

For a pure SQL solution you could use REPLACE.

这篇关于如何加密数据库的所有现有存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆