Thursday, March 29, 2012

boolean function

It is possible to create a function that returns a boolean value in t-sql?

A "boolean" function in t-sql would use the "bit" datatype; an example might be something like:

create function dbo.reflectBit (@.prm_bit bit)
returns bit
begin

return (@.prm_bit)

end

go

select dbo.reflectBit (1) as aBit

-- aBit
-- -
-- 1

Give a look at the "bit datatype" article in books online.

No comments:

Post a Comment