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.