SQL query to decode a value returned from function
Posted on 2008-06-18
I have a stored procedure which has a few parameters.
One of the parameters is @Check
I need to decode a value returned from a function
fn_CheckValid which takes in a string of an order no and returns 0 or 1
what I need to do is if the value returned is 0 - interpret as false if 1 interpret as true
and then check this with @Check parameter. @Check can have only two vlaue true or false
So I need somehow to convert the value returned from the function to true or false and then check if it matches the parameter @Check
This is what I have now, but is incorrect since the value returned from function is fn_CheckValid is only 1 or 0 and the @check is only true or false.
fn_CheckValid(strOrder) = @Check