Simulating Boolean Return Values in SQL Server 2005
I know that the closest one can get to a boolean data type in SQL Server 2005 is the BIT
data type. However, SQL Server obviously works continously with boolean values (after all, it can handle comparisons). That bei开发者_开发知识库ng, is there any way one can "simulate" a boolean return value from an UDF? For example, I would like to be able to make a CHECK
constraint using the syntax
(...) CHECK (dbo.FunctionReturningTrue())
instead of
(...) CHECK (dbo.FunctionReturningBit() = 1)
.
Is that possible?
In MS SQL Server, no.
Boolean
is not a directly usable data type. You must compare the value to something.
精彩评论