sql server - t-sql: incompatibility between built-in boolean functions -
why built-in boolean functions behaves differently on null
input ? example - query:
select 'isdate(null)' function_call, isdate(null) result union select 'isnumeric(null)' function_call, isnumeric(null) result union select 'is_member(null)' function_call, is_member(null) result union select 'is_srvrolemember(null, null)' function_call, is_srvrolemember(null, null) result
gives us:
function_call result ---------------------------- ----------- isdate(null) 0 isnumeric(null) 0 is_member(null) null is_srvrolemember(null, null) null
so seems isdate
, isnumeric
behaves according boolean logic, is_member
,is_srvrolemember
- behaves according three valued logic. shouldn't boolean functions behave same on null input ? ansi sql standard says ?
thanks
i don't find odd these security functions (is_srvrolemember
) behave differently system/datatype functions (isnumeric
) since these security functions queries , results can change depending upon querying. meanings of return values, including nulls, spelled out of these in msdn documentation.
more concretely, arguments isnumeric
, isdate
, can test ahead of time if argument null or not, i'm not sure returning null necessary, or has practicality.
for arguments security functions, may have non-null arguments, functions have been built in helpful manner return null in cases arguments aren't valid, not found, or don't have permissions know answer.
much of can seen subjective, have voted close question, interesting may be.
Comments
Post a Comment