开发者

Simulating Boolean Return Values in SQL Server 2005

开发者 https://www.devze.com 2023-03-11 01:45 出处:网络
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 compar

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消