Showing posts with label encryption. Show all posts
Showing posts with label encryption. Show all posts

Friday, March 23, 2012

Script to Add WITH ENCRYPTION to all SPs, Vs and Fns

I'm about to roll out a new database to another site and would like to encrypt all stored procedures, views and functions. I know this can be done by simply adding WITH ENCRYPTION in the appropriate spot, but I don't want to edit every single stored procedure, view and function one by one.

Is there a way (and if so, how do I go about it) to first of all output all stored procedures, views and scripts to a file, (not using enterprise manager, but rather using a sql script) then encrypt them all?

Essentially, I need to output them all to a file first just in case I have to edit them again.

Any ideas on how I would go about this?

Thanks in advanceAnyone have any clues?|||you need to script out the sp/fn/etc, then use FileSystemObject to read the file in and look for " AS" and prefix it with "with encryption". There isn't any *automated* way or sql builtin tool.