0

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 no idea on how to get to the SQLPackage.exe file. Is it the file on the BUILD SERVER for DevOps? I tried to create a system variable on my local machine and failed. It wasn't recognized. I need to figure out a way to work around the possible data loss issue on automated builds. Thank you for any help!!

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • I assume you have an SSDT project and are trying to deploy structural changes to your database? If so you could add a tag for ssdt. Also, instead of tagging sql, try sql-server or azure-sql-database for clarity. The data loss error indicates that there is a possibility that you could lose data from making the structural change you are about to make. Are you sure you want to make this change before you override the flag? e.g. if this was an empty table then it probably doesn't matter. – SMM Mar 08 '22 at 15:47

1 Answers1

0

You don't change something like this in the exe, but configure the application to behave the way you want it to behave.

There are a couple of options to have the publish not block on possible data loss. For instance, if you're creating a dacpac you can specify it there.

When running the application from the command line, there's a command line parameter you can set:

/p: BlockOnPossibleDataLoss=(BOOLEAN 'True')

Specifies that the operation will be terminated during the schema validation step if the resulting schema changes could incur a loss of data, including due to data precision reduction or a data type change that requires a cast operation. The default (True) value causes the operation to terminate regardless if the target database contains data. An execution with a False value for BlockOnPossibleDataLoss can still fail during deployment plan execution if data is present on the target that cannot be converted to the new column type.

More information: SqlPackage Publish parameters, properties, and SQLCMD variables - Parameters for the publish action

rickvdbosch
  • 14,105
  • 2
  • 40
  • 53