Is there a TSQL function that allows to validate an operation? Example:
Select (1 = 0)
should return false
while Select (1 = 1)
should return true
or
Select ('a' = 'b')
should return false
while Select ('a' = 'a')
should return true
Thanks in advance, and sorry for my bad English.
Best Answer
You could use the
BIT
datatype to representboolean data
. ABIT
field's value is either1,0 or null
.In SQL you use
0
and1
to set a bit field (just as a yes/no field in Access). In SQL Server Management Studio it displays as aTrue/False
value (at least in recent versions).When accessing the database through ASP.NET it will expose the field as a boolean value. Thanks @guffa, This answer from here
Example: