Questions tagged [sqlpackage]

A command line utility for automating SSDT database deployment tasks.

SqlPackage.exe is a command line utility that automates the following database development tasks:

  • Extract: Creates a database snapshot (.dacpac) file from a live SQL Server or Windows Azure SQL Database.

  • Export: Exports a live database - including database schema and user data - from SQL Server or Windows Azure SQL Database to a BACPAC package (.bacpac file).

  • Import: Imports the schema and table data from a BACPAC package into a new user database in an instance of SQL Server or Windows Azure SQL Database.

  • Publish: Incrementally updates a database schema to match the schema of a source .dacpac file. If the database does not exist on the server, the publish operation will create it. Otherwise, an existing database will be updated.

  • DeployReport: Creates an XML report of the changes that would be made by a publish action.

  • DriftReport: Creates an XML report of the changes that have been made to a registered database since it was last registered.

  • Script: Creates a Transact-SQL incremental update script that updates the schema of a target to match the schema of a source.

The SqlPackage.exe command line allows you to specify these actions along with action specific parameters and properties.

196 questions
6
votes
1 answer

How to deploy SQLPROJ DACPAC to Amazon RDS

We have always done our database design and development with VS2012 SSDT using the .sqlproj extension, and deployed to SQL Server using SQLPackage with a DACPAC... or alternatively setup a publish rule from Visual Studio. We have migrated our…
6
votes
3 answers

SQLPackage error: An item with the same key has already been added

I get this error from SQLPackage: "An item with the same key has already been added" What is the meaning? Google won't help me.. "c:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe" /Action:DeployReport /SourceFile:"XXX.dacpac"…
SAS
  • 3,943
  • 2
  • 27
  • 48
5
votes
2 answers

Detailed diff between two dacpac files

I am using the sqlpackage utility and MSBuild to generate source and target .dacpac files from our database and database projects. I am aware that I can generate publish scripts and even do deployment reports, but these reports are only at a…
5
votes
0 answers

Create User in dacpac deployed by SqlPackage.exe leads to login failed SqlException

Problem I'm trying to automate SQL deployment including User and Roles. It works when I create the user in Sql Management Studio, but when I deploy dacpack I get SqlException: Login Failed for user 'MyUser' Description I have SQL Server 2016…
Liero
  • 25,216
  • 29
  • 151
  • 297
5
votes
1 answer

Sqlpackage.exe Deploy to Azure: Can I specify performance tier?

When using SQLPackage.exe to deploy a DACPAC to an Azure SQL database, is it possible to specify the performance tier of the database to be created? Or do I need to create the database, then issue a separate command to downgrade/upgrade? I've…
5
votes
1 answer

How can I perform a data compare on a VS 2013 SSDT project programmatically?

Visual Studio 2013 has a feature that allows for performing a data compare between your SSDT project and a target database. According to another post here on SO, there are certain requirements with regards to performing such a compare. Those…
nils1k
  • 467
  • 5
  • 20
5
votes
1 answer

can dacpac be used for managing databases having large volume of data?

Our current database is of nearly 200MB, but once the application goes live, we are expecting this to grow to a large volume.. may be, 20-30 GB of data in that. We are planning to use "dacpac" (generated by database project - SSDT) to deploy on…
Nirman
  • 6,715
  • 19
  • 72
  • 139
5
votes
1 answer

How to upload (import) with overwrite azure database using sqlpackage.exe

It should be a simple thing to do, I want to upload/import my database with overwrite option, but I can't find it in the documentation I have to delete it manually and upload with Import.
Toolkit
  • 10,779
  • 8
  • 59
  • 68
4
votes
2 answers

Can Sql Package Exe Run Post Deployment Script In Command Line?

The following will deploy Sql database with sqlpackage.exe. This does not require use of Publish Profile Xml. Is there a way to add simple post-deployment script inline, without having external post-deployment file? Eg: will publish database inline,…
user11915641
4
votes
1 answer

Error SQL0: The reference to external elements from the source named 'MyDatabase.dacpac' could not be resolved, because no such source is loaded

I'm getting this error when using sqlpackage.exe, or the DacFx DLLs, to programmatically publish a dacpac (A), compiled and provided by a different team, which in turn has a dependency on another dacpac (B). I can confirm that: The reference to B…
Simon Green
  • 1,131
  • 1
  • 10
  • 28
4
votes
5 answers

SSDT Publish - Object Reference not set

I am trying to publish an SSDT project and it is throwing an error "Object reference not set to an instance of an object" No other message, is there a way to troubleshoot this.
Shiju Samuel
  • 1,373
  • 6
  • 22
  • 45
4
votes
1 answer

SSDT How can I create a new database from a DACPAC file?

Currently using SqlPackage.exe cmd line tools to generate a script, by comparing DacPac file with a target database. This will Create the database if it doesn't already exist. We now want to switch this to use the Microsoft.Data.Tools.Msbuild Nuget…
Fish
  • 138
  • 1
  • 7
4
votes
2 answers

SQLPackage not found in SQL Server on Linux

I am trying to do dacpac deployment using SQLPackage on Linux. My environment: Server : Ubuntu Linux version 16.04 SQL Server 2017 latest release candidate version RC1. SQL Server installation is successful and I am able to create tables on SQL…
Kannan Kandasamy
  • 13,405
  • 3
  • 25
  • 38
4
votes
1 answer

sqlPackage.exe not including dropped stored procedure in deployment script

I have a SQL Server database project in Visual Studio and I have dropped an existing stored procedure. I also have a database locally where that exact stored procedure exists. When I run a schema compare from within Visual Studio on both, in the…
dhughes
  • 645
  • 1
  • 7
  • 19
4
votes
2 answers

Rolling back a failed DACPAC with SqlPackage.exe

I have regularly used EF migrations to deploy databases, both from scratch and for evolution. I am currently however working on another teams project that use DACPACs, which seemed just as good, until today. Today, I added a Unique Key Constraint to…
Michael Armitage
  • 1,502
  • 19
  • 17
1
2
3
13 14