我有幸在工作中使用Visual Studio 2012 Premium.我给出的任务之一是在开发和系统测试数据库之间进行模式比较.这一切都很好,但是当我生成脚本移交给迁移团队时,我在标题处得到了这个:
/* 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)]; ...
现在,将它修剪成一个.sql脚本并不难,只需在SSMS中运行即可.但我已经看到以前版本的Visual Studio有一个"导出到Transact-SQL"选项.这个选项隐藏在2012年吗?我能找到的最好的选择是注释掉SQLCMD线.
谢谢!