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
2
votes
0 answers

SSDT Update/Deploy - How can I ignore references to other databases in code

Im trying to work on a database after importing it into a sql server database project. There are procedures that refer to another database on the same server, but its a monster and id rather not import that database into the solution. Ive created…
bitshift
  • 6,026
  • 11
  • 44
  • 108
2
votes
1 answer

How can sqlpackage.exe perform schema compare only on stored procedures?

In VS 2012, the schema compare tool let's users compare only "stored procedures" by selecting the option "stored procedures" as the application scoped object. Is there a way to perform schema compare only on the selected schema object using…
Ruth
  • 23
  • 3
2
votes
2 answers

SqlPackage.exe export/import database

After the migration of Azure to database to V12 preview using SqlPackage.exe to export and the import the DB to the local machine I obtain the error: Error SQL72014: .Net SqlClient Data Provider: Msg 2760, Level 16, State 1, Line 1 The specified…
Achille
  • 95
  • 6
2
votes
2 answers

Error on run SQLPackage.exe /a:script

I'm trying to automate the database deploy process an I'm using the SqlPackage.exe. I have some database deployment process working with this exe but recently I've been facing an problem to a new database. When I try to run: "C:\Program Files…
Aitiow
  • 882
  • 2
  • 9
  • 18
2
votes
0 answers

SQL Server, I can execute sqlcmd with trusted connection but not sqlpackage

We have some deployment scripts that use a combination of dacpacs through sqlpackage and straight scripts using sqlcmd. When I execute the sqlpackage dac\sqlpackage.exe /p:BlockOnPossibleDataLoss=False /p:BackupDatabaseBeforeChanges=True /a:Publish…
CodeHulk
  • 111
  • 1
  • 12
1
vote
0 answers

sqlpackage error "Object reference not set to an instance of an object." message

I got below error: C:\source>sqlpackage /Action:Script /SourceFile:".\src\Databases\Demo.Build\publish\Demo.Build.dacpac" /OutputPath:".\test.sql" /TargetServerName:demo.database.windows.net /TargetDatabaseName:DemoDB /TargetUser:demo …
Sol Lee
  • 71
  • 3
1
vote
1 answer

How to redirect sqlpackage StdError stream through .NET Core

I need to call SqlPackage from a C# .NET 7 application and I'm doing so by creating a System.Diagnostics.Process. My sample code can be found below. I can run the command, however whenever I redirect stdError if there is no error in the command I am…
1
vote
0 answers

Problem with deploying IN-MEMORY db table changes with existing SCHEMABINDING dependencies

We have many automated deploys of in-memory and regular databases. Build produces dacpac, then SqlPackage.exe performs deploy. Recently we've faced an issue when tried to add new column to the table in IN-MEMORY database. There was a function…
1
vote
0 answers

Is there a way to prevent dropping columns when publishing with SSDT?

I'm in a multi-tenant environment and some tenant databases have custom columns in the common tables that all tenants share. The SQL Server Data Tools project only contains the schema for the common columns in the tables. So when I try to publish…
roverred
  • 1,841
  • 5
  • 29
  • 46
1
vote
1 answer

SQLPackage deploy a dacpac file using Universal Authentication

I have an Azure DevOps YAML pipeline that is currently deploying my Azure SQL database with SQLPackage.exe and SQL Authentication with pretty standard command: SqlPackage.exe /Action:Publish /SourceFile:"mydb01.dacpac"…
1
vote
3 answers

sqlpackage migration script always wants to rebuild

Can anyone explain when using sqlpackage.exe to produce a migration script always wants to drop the table and recreate when adding a field. My databases are hosted on Azure PaaS service. I have a database with a table created with the following…
mattb
  • 384
  • 1
  • 4
  • 24
1
vote
0 answers

Linux PowerShell The term 'sqlpackage' is not recognized as a name of a cmdlet

Until now, every thing was ok with this command in PowerShell. But after update/reboot i'have troubles... sqlpackage /a:Extract /scs:"Data Source='$sourceServer';Initial Catalog='$sourceDatabase'; User ID='$sqlUser';Password='$sqlPass'" /tf:$dacpac…
stefmex
  • 584
  • 1
  • 6
  • 11
1
vote
0 answers

SqlPackage does not deploy referenced DAC package

I have created a solution with two database projects: Dependent.sqlproj and Dependency.sqlproj. The Dependent.sqlproj references to Dependency.sqlproj: Dependency
Alexander
  • 4,420
  • 7
  • 27
  • 42
1
vote
1 answer

Azure SQL DacPac deployment failing when trying to drop a column even though /p:BlockOnPossibleDataLoss=False is set for SqlPackage.exe

Though I am using flag BlockOnPossibleDataLoss=False in my Azure SQL Dacpac Deployment pipeline, it is ignoring the flag producing the following errors, Can someone suggest what I am missing- *** Could not deploy package. Error SQL72015: The column…
LoGan
  • 97
  • 4
  • 13
1
vote
1 answer

sqlpackage.exe publish fails with no error

I have the below powershell script which runs from jenkins against windows server 2019 slave: $sqlpackagepublish = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database…
arielma
  • 1,308
  • 1
  • 11
  • 29