Dear All,
Can you help me below task:
I have a table with Ename nvarchar(50), Desig nvarchar(50),Status nvarchar(50)
Table Data is:
id Ename Desig Status
1 Amar Admin 0
2 Sai TL 1
3 Vishal PM 0
When calling with Select Statement Status Column I want to show shows 0 is Not Available 1 is Available 2 Working
Please Help Me
Pradeep ShetPosted Sep 14, 2014, 5:23 PM
You can write case as shown below
SELECT Ename, CASE
WHEN Status = '0' THEN 'Not Available' WHEN Status = '1' THEN 'Available'
WHEN Status = '2' THEN 'Working' END AS Status
FROM Tbl
I hope this is what you were expecting.
Mark it answered if it helped
VulpesPosted Sep 14, 2014, 5:22 PM
SELECT id, Ename, Desib, Availability =
CASE Status
WHEN '0' THEN 'Not available'
WHEN '1' THEN 'Available'
WHEN '2' THEN 'Working'
END
FROM MyTable