Hmm. If anyone is wondering why 'Lennie' mentioned CASE before - it's because (s)he asked the same question on another site and has become confused as to who said what where.
It seems Lennie is actually asking how to use the IIF statement in SQL Server to 'decode' a bit column. The answer given on the other site was to use CASE. No example was provided there, so Lennie got a grump on.
Lennie, instead of:
Select SupplierID, SupplierName,
iif (Status = 1, 'Active', 'NotActive') as [Status]
from TblSupplier
Use:
SELECT SupplierID,
SupplierName,
[Status] =
CASE
WHEN [Status] = 1 THEN 'Active'
WHEN [Status] = 0 THEN 'NotActive'
ELSE NULL
END
FROM dbo.tblSupplier;
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi