I built a simple sproc that runs an executable using xp_cmdshell. I want to be able to identify errors when the executable is called. The variable XPCmdShellResult contains a bit value. When the compiler hits the IF clause it balks, presenting the following:
An expression of non-boolean type specified in a context where a condition is expected, near 'BEGIN'.
If I modify the IF clause to the following:
IF @XPCmdShellResult > 0
The procedure runs properly, but I should be able to @XPCmdShellResult to behave as a Boolean without the comparison operator. (It's cleaner.)
CREATE PROCEDURE dbo.CallRTXMLExportTool
SET @ErrorHint = 'Not Configured'
SET @XPCmdShellCommand = 'C:\RTXMLExportTool.exe'
EXEC @XPCmdShellResult = xp_cmdshell @XPCmdShellCommand, NO_OUTPUT
IF @XPCmdShellResult -- Problematic code here.
-- Error code not shown.