SQL Scripts Manager 2

Worked example - adding a new script to SQL Scripts Manager

You can use SQL Scripts Manager to build a simple graphical user interface for any SQL, Powershell, or IronPython script.

Using one of your own scripts with SQL Scripts Manager

  1. Locate your script code (for example, a T-SQL script), and make a copy.

    You need to edit this copy to make it suitable for use with SQL Scripts Manager.
  2. Before you can use your script with SQL Scripts Manager, you must convert it into an _.rgtool_ XML script file. This involves wrapping your script code with appropriate XML elements and attributes, such that the resulting file is a valid SQL Scripts Manager XML file. You should also rename your script file to have an _.rgtool_ extension.

    Refer to The SQL Scripts Manager XML schema topic for detailed information about the format of _.rgtool_ XML script files.
    You will also need to define a graphical user interface (GUI) for your script. The GUI definition is part of the XML script file, and enables you to add controls for selecting a SQL Server instance or database, and to map other controls to parameters required by your script (such as text boxes and option buttons). See Types of control for detailed information about specifying GUI controls.
    Alternatively, you may find it easier to start with a copy of one of the _.rgtool_ files provided with SQL Scripts Manager. To locate these files, select File > Show Scripts Folder from the main SQL Scripts Manager window.
  3. Once you've finished editing your new _.rgtool_ file, save it to the SQL Scripts Manager scripts folder, located at _\Documents and Settings\All Users\Application Data\Red Gate__SQL Scripts Manager___ by default.
  4. Start SQL Scripts Manager.

    If your _.rgtool_ file is valid, the script will be shown in the list on the main SQL Scripts Manager window, ready to run.
    If there are problems with the file, it is associated with the '<Load Error>' tag, and the error is shown beneath the script title in the scripts list:

    SQL Scripts Manager load errors relate to problems with the XML structure of your _.rgtool_ file.

    Any syntax or logic errors in the script code (the code contained within the <script> tags in your _.rgtool_ file), will not be evident until you run the script using SQL Scripts Manager.

Didn't find what you were looking for?