CREATE TABLE #Temp (b BIT NOT NULL);INSERT #Temp VALUES (1);INSERT #Temp VALUES ('True');INSERT #Temp VALUES (456);
(1 row(s) affected)Server: Msg 245, Level 16, State 1, Line 2Syntax error converting the varchar value 'True' to a column of data type bit.
Select SupplierID, SupplierName, iif (Status = 1, 'Active', 'NotActive') as [Status]from TblSupplier
SELECT SupplierID, SupplierName, [Status] = CASE WHEN [Status] = 1 THEN 'Active' WHEN [Status] = 0 THEN 'NotActive' ELSE NULL ENDFROM dbo.tblSupplier;
Jul 13