archrival Posted August 12, 2007 Posted August 12, 2007 (edited) 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 ConnectionsSQL 2005 Trace Flags, -T 7806 is used for SQL ExpressUsing a Dedicated Administrator Connection Edited August 27, 2008 by archrival
weaponx Posted August 17, 2007 Posted August 17, 2007 Why so many FileWriteLine(s) ? Could it be done with one FileWrite?
archrival Posted August 26, 2008 Author Posted August 26, 2008 Modified code, decrypts all items, has a GUI.
archrival Posted August 26, 2008 Author Posted August 26, 2008 Further code updates, also including more information about DAC, please see first post.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now