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
Anonymous
January 06, 2011
Hey Dude, Thanks for this but it dosent work yet, the name space in the sqlvars has changed to: urn:Microsoft.VisualStudio.Data.Schema.Project.SqlCmdVars 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. SiAnonymous
January 07, 2011
The comment has been removed