Template Driven Sql Generation Updated for Visual Studio 2010

More than a year ago I presented a simple template processor for Visual Studio 2008 Database Projects. This add-in gives you the ability to write Transact-SQL in a simple template form with embedded SQLCMD variables. It’ll turn

--*CREATE TABLE [dbo].[$(MyVar)] --*( --* column_1 int NOT NULL, --* column_2 int NULL --*)

Into valid Transact-SQL

CREATE TABLE [dbo].[MyReleaseTableName] ( column_1 int NOT NULL, column_2 int NULL )

I’ve updated the add-in to work with Visual Studio 2010. The essential details haven’t changed so please refer to my past post. If you wish to recompile the source you’ll need Visual Studio 2010 (professional or ultimate) and the Wix Toolset.

The source code for the Visual Studio ProcessSqlTemplate MSBuild Task and Add-in is here.

The ProcessSqlTemplateAddIn MSI is located here.

Comments (2)

  1. Simon Stearn says:

    Hey Dude,

    Thanks for this but it dosent work yet, the name space in the sqlvars has changed to:


    I've changed the code to discover the namespace once the document is loaded in PropertiesFile so insted of passing the variable holding the hardcoded namespace variable, i've used the following doc.DocumentElement.NamespaceURI

    Might save you some trauma trying to debug this.


  2. Patrick Sirr says:

    Thanks!  You are correct.  I moved onto a clean machine (my dev box must have been messed up) and fixed the issue.  Everything should work now.

Skip to main content