SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Encrypt All Stored procedures at once


Encrypt All Stored procedures at once

Author
Message
kodracon
kodracon
SSC-Enthusiastic
SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)

Group: General Forum Members
Points: 101 Visits: 162
Comments posted to this topic are about the item Encrypt All Stored procedures at once
Shivrudra
Shivrudra
SSC Veteran
SSC Veteran (215 reputation)SSC Veteran (215 reputation)SSC Veteran (215 reputation)SSC Veteran (215 reputation)SSC Veteran (215 reputation)SSC Veteran (215 reputation)SSC Veteran (215 reputation)SSC Veteran (215 reputation)

Group: General Forum Members
Points: 215 Visits: 880
how to Dcrypt it...

Regards,
Shivrudra W
Brad-1060956
Brad-1060956
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 39
worked well on some stored procs but missed some for no real reason that I can see.

Very handy non the less.

Thanks
Naomi N
Naomi N
Valued Member
Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)Valued Member (65 reputation)

Group: General Forum Members
Points: 65 Visits: 232
I think this code is prone to errors. If 'AS' is part of the parameter's name, for example.
kodracon
kodracon
SSC-Enthusiastic
SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)SSC-Enthusiastic (101 reputation)

Group: General Forum Members
Points: 101 Visits: 162
you can't decrypt it, but if you follow the instructions there should be a backup up of your sp's in the database...
cameron.wells
cameron.wells
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 185
There are a couple of issues I found with the script Chris.

1- If there was no BEGIN after the AS at the beginning of the SP then the WITH ENCRYPTION syntax could not be inserted into the text of the SP

2 - Because the way syscomments stores the text of the SP's (by spreading the text over multiple rows of the system view when the text of the SP is over a certain length), that when trying to join all the text back together, some text is truncated because of the insertion of more text when inserting 'WITH ENCRYPTION', this then breaks the SP therefore when trying to alter it, by running EXEC (@sptext) it fails and is therefore caught by the CATCH statement which says

the stored procedure 'SPNAME' cannot be encrypted automatically.


You will find any SP that is over 'apprx' 200 lines, that your script wont automatically encrypt them. Also if there is no BEGIN after the AS statement, that the script will also fail for that SP.

i.e.

ALTER Procedure [dbo].[BCPReplicationIn]
AS
begin <-- If this BEGIN doesn't exist the script wont insert WITH ENCRYPTION before the AS.

I was trying to get your script to work, but it seems like a hard task mainly because of the way sys.syscomments stores the text of the SP's. Hopefully you can find a way to make it work because it would be extremely handy to use.

Thanks,

Cameron
Iwas Bornready
Iwas Bornready
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13914 Visits: 885
Thanks for the script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search