Can I generate a deployment script from a dacpac

11,033

You can use SqlPackage.exe. Look for it on your machine in a directory with a name similar to this:

C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin

Note that it may be found in the 110, 120 or 130 folder.

If you don't have SqlPackage.exe already, you can download it from here: https://www.microsoft.com/en-us/download/details.aspx?id=53013

If you download it, be sure to look in the System Requirements section of the download page to find the dependencies SqlSysClrTypes.msi and SqlDom.msi, which must be installed as well.

Example usage:

SqlPackage.exe /a:script /SourceFile:C:\temp\mydb.dacpac /TargetConnectionString:"Data Source=myserver;Initial Catalog=mydb;Integrated Security=true" /OutputPath:C:\temp

Share:
11,033
Justin williams
Author by

Justin williams

Updated on June 08, 2022

Comments

  • Justin williams
    Justin williams almost 2 years

    I've got a .dacpac file that's being called by MSBuild and published to a QA database for testing. This publish is failing and the error I'm getting back from them is a generic "an error has occurred" message. I was hoping I could generate the deployment script from the dacpac and walk through it to see where the problem is occurring and hopefully teach them how to do this as well.

    Is there any way to point a dacpac at a specific database and have it generate the sql for updating the database without actually publishing to the database?

  • Serj Sagan
    Serj Sagan about 4 years
    FYI: the above reference is for an outdated version of SqlPackage.exe here is the current latest: microsoft.com/en-us/download/details.aspx?id=53013