Click here to Skip to main content
Click here to Skip to main content

SQL Server Runner - Part 1

, 13 Dec 2008
Rate this:
Please Sign up or sign in to vote.
Console and GUI utility application that executes SQL scripts against SQL Servers (7, 2000, and 2005) - version 2.0.1.2 is now available.

SQL_Runner_Logo.gifSQL SERVER RUNNER

Introduction

SQL Server Runner is a .NET application that allows users to execute SQL scripts against SQL Server databases. Its intuitive GUI makes the task of running scripts an easy one; it is an indispensable tool for those DBAs/Developers that need to work with SQL Server.

Two minor versions were created since this article was written. In the latest version (2.0.1.2), a placeholder feature allows to write SQL scripts using variables; when a script is executed, the variable is automatically replaced by the value stored at the application configuration file.

Background

For years, I always found it useful to have an easy way to update my SQL Server databases, this application addresses the issue; the GUI application can be used to test scripts and produce a SQL Server Runner project that can be used by the console version. Development teams that need an automated way to update their databases may find that the console version fulfills their requirements; NAnt can be used to call the application, and the logging level can be modified to provide different types of information as the application uses log4Net.

Features overview

General features

  • Executes multiple scripts in one single execution.
  • Full error message is reported if script fails.
  • The connection manager allows the user to indicate how the connection behaves during the execution of the scripts, for example:
    • All scripts are executed in one single transaction, if a script fails the transaction is rolled back.
    • Scripts execute in a transaction that is rolled back at the end of the transaction. This is useful when testing scripts.
  • log4Net is used to report and audit the execution process. The default logger uses a log file, but this could be changed to use email, SQL Server tables, or even the Windows application log.
  • Scripts can be written using variables so the application replaces them when they are executed.

GUI application

  • The GUI application helps to create projects that can be executed using the command line application.
  • Individual folder flags to indicate if subfolders must be executed.
  • Tree view window that reports which folders and scripts were executed.
  • SQL native error message window to report individual script failures.
  • A double click in a script in the tree view window opens the script in the default SQL Server script editor.
  • A color scheme is used in the script window to easily identify folders/scripts that have failed.
  • A "cancel" function is available so the execution can be stopped.
  • The counter section returns the total number of scripts executed, the number of scripts that failed, and the total time that the scripts took to execute.
  • A progress bar indicator is displayed during the execution of the scripts.

Console application

  • Executes SQL Server Runner projects directly from the command line.
  • Error indicator parameter indicates if the application should return an error if one or more scripts fail. It can also be used to indicate if the execution must stop if a script fails.
  • The console application was enhanced in version 2.0.1.0, so the connection managers are also available from the command line.

Screenshot

SQLServer_1_2_0_1_Execution.gif

Getting the application

Please have a look at the documentation that you can find at the SQLRunner website which is located within the Microsoft Open Source web at CodePlex. The manual/tutorial describes all the application features in detail, and it can also be used as a guideline to find out how to use the application.

Relevant links

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Enrique Albert
Software Developer (Senior)
Ireland Ireland
No Biography provided
Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 4 PinmemberSanjeevSingh14-Sep-11 23:51 
GeneralCreate database PinmemberTodd Smith13-Dec-08 10:18 
AnswerRe: Create database PinmemberEnrique Albert21-Dec-08 7:14 
It is a good suggestion, would you please create a new ticket at www.codeplex.com\sqlrunner[^] explaining what functionality you'd like to see when creating a new database, i.e. file location, initial size and so on.
Thanks

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 13 Dec 2008
Article Copyright 2008 by Enrique Albert
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid