Skip to content

Instantly share code, notes, and snippets.

@javafun
Forked from anova/sqlpackage.md
Created Sep 24, 2019
Embed
What would you like to do?
Sqlpackage.exe samples

Export

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

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