0

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 of these:

  1. dacpac file.
  2. SQL Project in .net
  3. SQLPackege.exe arguments.

Added These SQLPackage.exe arguments:

/p:DropObjectsNotInSource=true /p:BlockOnPossibleDataLoss=false /p:AllowDropBlockingAssemblies=true

Facing these errors:

*** Could not deploy package.
Warning SQL72012:
Warning SQL72015:
Warning SQL72014:
Warning SQL72045:

These StackOverFlow links didn't help me or similar:

  1. Deploy DACPAC with SqlPackage from Azure Pipeline is ignoring arguments and dropping users

  2. Is it possible to exclude objects/object types from sqlpackage?

I am expecting that my Source and Target DBs should have equal tables

  • Can you use some commands or other methods on the local machine to make the Source DB and Target DB have the same tables? If you can do this on your local machine, you can do the same thing with some tasks in DevOps. – Ziyang Liu-MSFT Nov 17 '22 at 06:59
  • Actually we wanted to automate synching our databases by azure devops otherwise this can be done by SQLCompare Tool @ZiyangLiu-MSFT – Abuzar Ansari Nov 17 '22 at 07:39
  • Install the powershell module with command 'Install-Module -Name SqlChangeAutomation -AllowClobber -Force -AcceptLicense' on your local machine. Then use [self-hosted agent](https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#install) to run the pipeline and from [PowerShell task](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/powershell?view=azure-devops) to point to the install path where the SQLDataCompare.exe is located. After that you can run SQL Data Compare command in the PowerShell task. – Ziyang Liu-MSFT Nov 22 '22 at 02:20

0 Answers0