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

sqlpackage publish fails if sqlcmd variable is not provided

I have an SQL project where I need to run certain scripts depending on the value of an SQLCMD variable When I pass the variable on sqlpackage.exe (i.e. /v:var=value) it works as expected, but when I don't pass the variable it fails instead of using…
Mickey Cohen
  • 997
  • 7
  • 23
2
votes
2 answers

Customizing deployments of a SQL Server Data Tools (SSDT) package using sqlpackage.exe to vary per environment

I have a SQL Server Data Tools (SSDT) .sqlproj files that contains, among other things, a Table Type like the following: CREATE TYPE [dbo].[tableType] AS TABLE ( [id] uniqueidentifier INDEX [idx], ) WITH (MEMORY_OPTIMIZED = ON); I…
Erick T
  • 7,009
  • 9
  • 50
  • 85
2
votes
1 answer

Importing Database via BACPAC / DACPAC Failing On Users When Using CLI Tools (sqlpackage.exe / PS dbatools)

Goal Clone a SQL database to a different remote SQL Server using a PowerShell script What Works Using SSMS to import the BACPAC file into different servers (remotely & local) works without (reported) warnings or errors. What Doesn't Importing the…
andrewjamesbowen
  • 622
  • 8
  • 14
2
votes
1 answer

Override SSDT publish profile ConnectionString

I am using the following command to generate to publish database changes using SSDT: "C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe" /Action:Publish /sf:DB.dacpac /Profile:publish.xml I would like to supply database connection…
2
votes
0 answers

How to execute SqlPackage command line to generate script without USE statement

How to get rid of the USE statement when using SqlPackage command line method when the target DB is a Azure Database ? When executing: SqlPackage /a:script [...] I always get : GO :setvar DatabaseName "databasename" :setvar DefaultFilePrefix…
2
votes
1 answer

How to get a Drift Report from Azure DevOps DACPAC deployment?

I would like to get a Drift-Report (and Deploy-Report and TSQL-script) during our DACPAC deployments. We are running DACPAC deployment in Azure DevOps to on-prem SQL server, using the agent task "WinRM - SQL Server DB deployment". This task is…
2
votes
0 answers

SSDT exclude fill factor from table definition

SSDT has an option to ignore fill factor (IgnoreFillFactor). But what it actually does is: it doesn't flag object as changed if there are only fill factor changes. If there are some additional changes fill factor will be published together with…
2
votes
3 answers

Is it SSDT bug - excluding encrypted trigger?

I have asked this question on MSDN forum without any response. Maybe here someone could help me? I think it's a bug in SSDT and quite old one. I've tried several versions of SSDT binaries but the problem persists. SQLPackage.exe doesn't exclude…
Brun0
  • 21
  • 2
2
votes
0 answers

How to re-validate all views, stored procedures and functions

I am trying to perform automation of my build for CI and allow automatic deployment( I have access to SQL CMD exe on build machine). The developers are writing out views, stored procedures and related functions without properly modifying all the…
2
votes
1 answer

SQL Server on linux unable to export to bacpac

I'm trying to export my database to a .bacpac file. I get the following error: (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) The command I'm using is: /opt/mssql/bin/sqlpackage /action:Export…
Jake Smith
  • 2,332
  • 1
  • 30
  • 68
2
votes
1 answer

Import bacpac database with SqlPackage, check exist and specify location

Can I run SqlPackage to import bacpac, which can check database exist before run, and also specify where to put the .mdf, .ldf file? So when the database exist, it will not do anything; but if it is not existed, it will import the database for me?
chinh nguyen van
  • 729
  • 2
  • 7
  • 18
2
votes
1 answer

Error SQL72014: The variable DatabaseName could not be found - DacPac, SSDT, SqlPackage.exe

I cannot realize what I did wrong and find something in the Internet. Does anybody knows what the reason for the following deploy stopper? Possibly this is those numerous settings of DacPac bublishing. Error SQL72014: SQL Execution error: A fatal…
it3xl
  • 2,372
  • 27
  • 37
2
votes
0 answers

Failed to import target model. The element is not supported in Microsoft Azure SQL Database v12

I'm setting up a CI for Azure SQL DB. When running C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130>sqlpackage.exe /SourceFile:"MyPackage.dacpac" /Action:Publish…
Arthur P
  • 1,050
  • 9
  • 16
2
votes
1 answer

Determine Target SQL Platform from a dacpac

Is it possible to determine the Target Platform that was used when creating a dacpac. I've looked at all of the parameters for SqlPackage.exe and none of them seem to give this information. Ideally I'd like to be able to determine this from the…
Ricky Keane
  • 1,540
  • 2
  • 15
  • 21
2
votes
5 answers

Using SqlPackage.exe on a server without SSMS installed

I have a windows 2012 server. The server can access my SQL database. I don't have access to the SQL database server, and I don't have access to install SSMS on the windows 2012 server running my website. I want to use SqlPackage.exe to update my…
Squazz
  • 3,912
  • 7
  • 38
  • 62