March 13, 2014 at 12:49 am
Hi All,
I need to prepare procedure text by using with encryption. For Now I am doing manually, but i need to do it all procedures at a time by using script.
Can anybody please let me know how can i achieve this by using script.
Thanks in advance.
March 13, 2014 at 4:31 am
Basically its a find and replace operation... you can select definition from sys.sql_modules to get the CREATE PROC statements but you need to change it to alter and add with encryption in the right.place.
Probably easier in a real text editor so id script outnall thenprocsnand do that in editplus or notepad++
Lowell
March 13, 2014 at 4:54 am
Lowell (3/13/2014)
Basically its a find and replace operation... you can select definition from sys.sql_modules to get the CREATE PROC statements but you need to change it to alter and add with encryption in the right.place.Probably easier in a real text editor so id script outnall thenprocsnand do that in editplus or notepad++
Thanks Lowell,
I have to do that in all the times, means i have to prepare more that 2 times in a month, for that is there any one time script, so i can execute that procedure in the selected database and i will get all the encrypted procedures.
Thanks,
March 13, 2014 at 5:16 am
Lowell's told you how to do it. If you want a script run once off to encrypt all procedures, write one up that does what he said.
Why are you going this route anyway? You do know just how easy that 'encryption' is to reverse?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 13, 2014 at 7:03 am
find and replace, in a proper text editor, because you would visually confirm each change, is absolutely the way to go.
a blanket find and replace is not going to be 100% accurate due to coding styles and stuff;
for example: if you search for CREATE PROCEDURE to repalce it with ALTER PROCEDURE
any differences in whitespace betweent he two words, or where a develoepr wrote CREATE PROC instead;
WITH ENCRYPTION needs to right before the AS keyword, but it depends on coding style, whether you can find 'nAS, or whitespace around it
-- Create Encrypted SP
CREATE PROCEDURE uspEnc
WITH ENCRYPTION
AS
SELECT GETDATE()
Lowell
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply