Best way to detect a "data loss" publish action when calling SSDT's SQLPackage.exe

389 Views Asked by At

When calling SQLPackage.exe (syntax described here) with publish action /a:Publish, there are cases when data loss occurs and the execution will be halted; this is specified by setting the parameter /p:BlockOnDataLoss (default to be 'true').

I need to know whether my publish action has succeeded or has failed due to 'data loss'.

Currently when succeeded, the returned exit code will be 0. And when failed, we just have the returned exit code to be 1. We cannot say whether a fail was caused by the data loss or not. How can we identify this?

Somewhere in the console output, we see the line that contain "... is being dropped, data loss could occur." So I intend to scan for every output line is printed but I guess there should be some other better way to do this.

Hope to hear what you think.

0

There are 0 best solutions below