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
31
votes
3 answers

Publish DACPAC to SQL Server 2014 using SqlPackage.exe?

I've been successfully publishing DACPACs to SQL Server 2008-2012 instances using SqlPackage.exe, as installed by SQL Server Data Tools (and typically found in C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin). However, in attempting to…
Nick Jones
  • 4,395
  • 6
  • 33
  • 44
13
votes
2 answers

Deploy SQL Server database project (SSDT) via command line

I have a SQL Server Database Project targeting a SQL Server 2012 RC0 database. The project was created in Visual Studio 2010 + SQL Server Data Tools CTP4. (The project type is different than the regular Visual Studio 2010 database projects -- it's…
Keith
  • 20,636
  • 11
  • 84
  • 125
12
votes
3 answers

DACPAC and SQL Sequence

I have a Visual Studio database project (DACPAC) which includes a number of SQL Sequences. However when I deploy the DACPAC it always resets the sequence value to the default value included in the Create script (in this case 1). e.g. CREATE SEQUENCE…
12
votes
2 answers

How to publish DACPAC file to a SQL Server database project via SQLPackage.exe of SSDT?

I'm using SSDT for Visual Studio 2012 here and using its command-line tool SQLPackage.exe to publish a .dacpac file. I want to publish that to an SQL Server database project. I'm trying to use parameter at this guide but cannot find ways how to do…
Nam G VU
  • 33,193
  • 69
  • 233
  • 372
11
votes
2 answers

Error: The reference to external elements from the source named 'master.dacpac' could not be resolved

I am building a database dacpac using sqlpackage on a windows machine. The project contains a reference to master.dacpac I take the move the dacpac to a linux machine (mssql-server-linux docker image) and restore the database. deploy-database.sh #…
Eamonn McEvoy
  • 8,876
  • 14
  • 53
  • 83
10
votes
1 answer

SqlPackage Object reference not set to an instance of an object

When I attempt to deploy DACPACs via SqlPackage.exe, I encounter the error below : An unexpected failure occurred: Object reference not set to an instance of an object.. Unhandled Exception: System.NullReferenceException: Object reference not set…
8
votes
2 answers

sqlpackage.exe: any way to ignore users on export?

I'm trying to create a bacpac file to export my databases to azure. Is there anyway of making it ignore the users, while creating an export package (sqlpackage /a:Export) ?
Luis Abreu
  • 4,008
  • 9
  • 34
  • 63
8
votes
3 answers

Is there any way to stop SqlPackage.exe setting default Filegroup in deployment script?

We are using Sql Server database projects to create deployment scripts from DacPac using SqlPackage.exe. We have different SQL Server Filegroups setup in various environments. When deploying we exclude Filegroups as we want objects to create in the…
Mike
  • 123
  • 8
8
votes
1 answer

How to make SSDT Profile.xml SqlCmdVariable an empty string or optional

I am using SSDT (and sqlproj) for our MSSQL projects. We have a few variables we need to set when publishing to each environment. This works great on most of our environments where we assign values to all of the variables, but when we publish to our…
Saan
  • 544
  • 5
  • 19
7
votes
2 answers

Azure Devops Unable to find the location of Dac Framework (SqlPackage.exe) from registry on machine

I am using azure devops to deploy a database to a virtual machine via deployment groups. I have verified that the system variable path is correct and also that it works when I log into the virtual machine and try to run it with powershell. I'm not…
OKolokolo
  • 91
  • 2
  • 5
7
votes
3 answers

How do I get SSDT Publish to not generate REVOKE CONNECT scripts

We have started using SSDT to manage our script deployments. Initially we used Schema Compare and unchecked the parts we did not want to deploy. We now have a need to use Pre and Post-Deploy scripts which only get included with the Publish…
SMM
  • 2,225
  • 1
  • 19
  • 30
7
votes
6 answers

'sqlpackage.exe' is not recognized as an internal or external command Error

I used maven,Microsoft SQL server management studio 17.SQL server verion is 14.0.1000.169. When i build my project it gives following error and build failed 'sqlpackage.exe' is not recognized as an internal or external command, operable program…
Jayani Sumudini
  • 1,409
  • 2
  • 22
  • 29
6
votes
1 answer

sqlpackage.exe publish conjunction exception

I'm trying to use sqlpackage tool for publish thought CMD: sqlpackage /action:Publish /SourceFile:"Database Services\bin\Release\Database Services.dacpac" /TargetDatabaseName:test /TargetConnectionString:"Data Source=TEST05,123;Integrated…
arielma
  • 1,308
  • 1
  • 11
  • 29
6
votes
4 answers

How can I prevent SqlPackage.exe from dropping and re-creating constraints when deploying a dacpac?

I have a Visual Studio sql project with a table defined like the following: CREATE TABLE [dbo].[Hoerses] ( [HoersId] INT NOT NULL PRIMARY KEY, [DatePurchased] datetime NOT NULL CONSTRAINT [DF_Hoerses_DatePurchased] DEFAULT…
Mike Asdf
  • 2,309
  • 26
  • 34
6
votes
1 answer

Differences between SqlPackage.exe and MsBuild SqlPublishTask

I'm trying to generate an output dacpac file which I can then deploy to different environments. Until now I was deploying directly from msbuild using the target publish, something like: msbuild dbproject.sqlproj /t:Build;Publish…
Cristian T
  • 2,245
  • 3
  • 25
  • 45
1
2 3
13 14