I Want convert bit
type to Yes or No
For Example:
SELECT FirstName, LastName, IsMale from members
>
SQL Server 2012 introduces two new keywords FORMAT
and IIF
that can provide a more compact means of converting an integer or bit to string:
DECLARE @MyInt int = 123
PRINT 'Hello '+FORMAT(@MyInt,'')
-- (note: the "+0" converts a bit type to int then outputs '0' or '1')
DECLARE @MyBit bit = 0
PRINT 'Hello '+FORMAT(@MyBit+0,'')
But to convert a bit
type to Yes
or No
I would now use:
PRINT 'Hello '+IIF(@MyBit=1,'Yes','No')