none
How to get rid of USE statement in deployment generated by SQLPackage script RRS feed

  • Question

  • The deployment script generated by the SQLPackage script action includes a USE statement which we do not want since the target database is an Azure SQL database. Is there an option to suppress this? 

    /*
    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)];


    GO
    USE [$(DatabaseName)];


    GO

    Thursday, May 16, 2019 7:38 PM

All replies