Jump to content

SQL Server 2005 Stored Procedure Decrypt/Export


archrival
 Share

Recommended Posts

This is a quick and dirty script I wrote using code gathered from the web to export encrypted stored procedures from SQL 2005 (using WITH ENCRYPTION). It will export unencrypted SPs as well. I needed something quick, and this is what I came up with. I would prefer to use DMO instead of sqlcmd for the export, but I've never had luck capturing the output of messages with DMO in AutoIt. This script will currently only export custom SPs, it's possible to remove the query for is_ms_shipped to export all SPs. Feedback and comments welcome and desired.

Edit:

Modified the script, this will now export all encrypted items, not just Stored Procedures. It has been updated to work with the SQL 2008 client tools, although it doesn't appear the decryption code will work against a SQL 2008 server. It will also query the network for all available SQL servers and display a list of all databases on the selected server. It may take some time to find all SQL servers, be patient.

Edit 2:

Modified script to check for DAC before trying to decrypt, also added tooltips for progress indicators.

Edit 3:

Further modified script to properly check for DAC, will no longer exit when DAC connection fails.

See these relevant links about DAC:

Remote Admin Connections

SQL 2005 Trace Flags, -T 7806 is used for SQL Express

Using a Dedicated Administrator Connection

Edited by archrival
Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...