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

Setup SQL project with references using dotnet project sdk

To be able to generate a dacpac and deploy it to a serverless SQL pool I would like to use the .NET project SDK. https://github.com/microsoft/DacFx I'm able to create a new project using the cli. dotnet new sqlproj -n ProductsTutorial I can also…
0
votes
1 answer

Using multiple SSDT projects per database? Or have any other ways of dealing with a large database in SSDT?

If one has a big database, it will be very slow to build. Especially if one has a lot of stored procedures and unit tests. One option would be to have two SQL projects that are responsible for different aspects of the database. Then each build…
0
votes
0 answers

How to delete only tables from target database using DACPAC or using SQLPackege.exe arguments which is not in Source DB? [Azure DevOps]

I have tried multiple ways to delete only tables from target database that is not in Source Database using dacpac. If anyone has better suggestion or solution to maintain Source and target DB similar in terms of tables only. Suggest solution in any…
0
votes
0 answers

How to capture changes made by Post Deploy script?

We need to capture all the changes on database by the Dacpac deployment. We are using sqlpackage Action:DeployReport command to capture the changes but this does not capture the changes made by post deploy script. Our post deploy script consists of…
aartil
  • 1
0
votes
1 answer

Sqlpackage error Could not read schema model header information from package. Collation 1033 is not supported

We are using gitlab as our devops pipline. I have a Microsoft SQL Server Database Project (.sqlproj), I need to deploy this to a AWS RDS SQL Server instance FROM a Ubutu docker image used in the gitlab pipeline, as per our devops department…
0
votes
1 answer

Import Data-Tier Application vs sqlpackage.exe

We are now encountering an error with an automated process when attempting to restore a .BACPAC file using the sqlpackage utility but are successful when importing the same file using the "Import Data-Tier Application" wizard through SSMS. The error…
0
votes
1 answer

How to make SqlPackage exclude indexes?

We're using SqlPackage to generate scripts via the Script action. Does anyone know a way to get it to exclude indexes? Can't seem to find a way. The SqlPackage reference gives several /p: properties to do with excluding a whole raft of other object…
Reg Edit
  • 6,719
  • 1
  • 35
  • 46
0
votes
1 answer

How do I alter the sqlpackage.exe?

Let me preface my problem with the fact that I am not familiar with command line/powershell. What I am up against is that my deployments are failing due to possible data loss. From what I read, I can change a variable from TRUE TO FALSE but I have…
0
votes
0 answers

How to execute a data script from inside of a .dacpac file (SSDT project) using powershell or any other tool?

When I publish an SSDT project, as shown in the attached image, it generates the .dacpac file. From that .dacpac file, I want to execute a specific script after publishing the .dacpac. Is it possible to do so? I mean is it even possible to access…
0
votes
1 answer

DACPAC error if External tables and data sources present at source db

Getting the following error on DACPAC deployment to Azure Synapse SQL Pools: Error SQL72018: SqlExternalDataSource could not be imported but one or more of these objects exist in your source. This has started since my colleagues created couple of…
ASHISH M.G
  • 522
  • 2
  • 7
  • 23
0
votes
0 answers

Dacpac to sqlproj - programmatically

I am trying to automate the following steps: We currently try to keep our database project (.sqlproj) up to date with out database, but this is currently a manual procedure. We open Visual Studio, put our database as source, put our sqlproj as…
Eviler
  • 39
  • 6
0
votes
1 answer

SQLPackage and DB on Azure

I am running sqlpackage from commandline: sqlpackage.exe /action:Extract /TargetFile:"C:\file.dacpac" /sourceDatabasename:dbsorgente /sourceservername:dummy.database.windows.net /p:ExtractAllTableData=True and I get error: [Windows logins are…
Riddick
  • 85
  • 7
0
votes
3 answers

How to include Sql Permission Statement with the generated DACPAC file

When I try to create a DACPAC file for my source database the SQL user permissions present in the source database is not getting included. Whenever I deploy the source database DACPAC file to target database the entire schema is getting created…
0
votes
1 answer

sqlpackage publish action stuck on Initializing deployment status

I have the below powershell script: $sqlpackagepublish = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/TargetConnectionString:""Data…
arielma
  • 1,308
  • 1
  • 11
  • 29
0
votes
2 answers

Using SqlPackage to Extract DB results in "Login failed for user "someUser""

I am new to using SqlPackage. I have a powershell command that looks something like .\SqlPackage.exe /TargetFile:"C:\\Program Files\\Microsoft SQL Server\\150\\DAC\bin\\somefile.bacpac" /Action:extract /SourceServerName:"someServer"…