Skip to content

Instantly share code, notes, and snippets.

Last active November 3, 2022 20:31
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Sqlpackage.exe samples


Creates a .bacpac file from live database.

"C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin\SqlPackage.exe" /a:Export /scs:"Data Source=SERVER;Initial Catalog=db_name;Integrated Security=False;Persist Security Info=False;User ID=db_user;Password=db_password" /tf:"D:\backup\database_backup.bacpac"


Import from .bacpac file to database.

"C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin\SqlPackage.exe" /a:Import /sf:D:\backup\database_backup.bacpac /tcs:"Server=.\SQLEXPRESS;Database=db_name;Trusted_Connection=True;"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment