Query database and cast bit value
Hi team! I have runbook in orchestrator one of the steps this runbook is Query database. In database table one column is a bit value. In this column can be such value as: 1, 0, null. When script run completed "Query database" in Orch returned value 0 and null - everything is right, but where value is 1 script returned -1. My question: Where I can edit type of return value for "Query database"? or what I can do in this case? Maybe someone know how it work?
Answers
In just about every "Query Database" control, I follow up with a PowerShell control. Typically to break the rows into usable data. Example
$SQLRaw = '[SQL Data row separated by ; ]'
$SQLdata = $SQLRaw.Split(";")
$ID = [string]$SQLData[0]
Then when I run into issues like this I use the PS to normalize the repose for the next control.
$Bool = $SQLData[1]
If ($Bool -eq -1) {$Bool = 1)
If ($null -eq $Bool) {$Bool = 0)
Now all the returns will be either 1 or 0.
HTH