How can I get the exit code from running SqlDataCompare in PowerShell?
Paul_at_HCI
Posts: 1 New member
We need to know if the data compare synchronization was successful for a database before synchronizing the next database.
How can I get the exit code to see if there was a problem? And if there was no difference, is this considered a failure?
How can I get the exit code to see if there was a problem? And if there was no difference, is this considered a failure?
Answers
Our cli tools write out their exit code to the terminals standard output, so in the instance of Powershell, that's
$LASTEXITCODE
Using the SQL Data Compare Exit codes used in the command line document, you can write the logic for how you want the workflow to behave. There is a code dedicated to finding identical dbs.
As for failure or not, that's dependant on how you configure it, please see the '/Include:Identical' option in cli switches document.