title: Export schema compare upgrade script to transact-sql with visual studio 2012 premium
body: <p>I have been blessed with Visual Studio 2012 Premium at work. One of the tasks I've been given is to do a schema compare between development and system test databases. This is all well and good, but when I generate the script to hand over to the migration team, I get this at the header:</p>
  
  <hr>
  
  <pre><code>/*
  Deployment script for MyGloriousDatabase
  
  This code was generated by a tool.
  Changes to this file may cause incorrect behavior and will be lost if
  the code is regenerated.
  */
  
  GO
  :setvar DatabaseName "MyGloriousDatabase"
  :setvar DefaultFilePrefix "MyGloriousDatabase"
  :setvar DefaultDataPath "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\"
  :setvar DefaultLogPath "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\"
  
  GO
  :on error exit
  GO
  /*
  Detect SQLCMD mode and disable script execution if SQLCMD mode is not supported.
  To re-enable the script after enabling SQLCMD mode, execute the following:
  SET NOEXEC OFF; 
  */
  :setvar __IsSqlCmdEnabled "True"
  GO
  IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True'
      BEGIN
          PRINT N'SQLCMD mode must be enabled to successfully execute this script.';
          SET NOEXEC ON;
      END
  
  GO
  USE [$(DatabaseName)];
  ...
  </code></pre>
  
  <hr>
  
  <p>Now, it is not difficult to trim this out and make it into an .sql script you can simply run in SSMS. But I have seen that previous versions of Visual Studio had an "Export to Transact-SQL" option. Is that option hidden in 2012? The best I can find is an option to comment out SQLCMD lines.</p>
  
  <p>Thanks!</p>