HI everyone, I have a column STATUS of type bit(1,0) , i would like to manipulate it(without editing the database) in the Store Procedure in such a way that if STATUS =1 // return result STATUS= 'Active ' Else if STATUS = 0 // return result STATUS = 'Inactive'
End if My Stored Procedure Is As Follow SELECT STATUS + '--' + NAME AS STATUSNAME FROM M_USER END Desired Result When Populated Into a Listbox Should Be As Follow Active--Tester Inactive--Tester1 Thanks In Advance for the Help Provided!
Thanks JBelthoff for the reply, I follow ur example but its still not working , the code are as follow, IF (@MASTER = 'NRICSEARCH') BEGIN SELECT CASE WHEN ACTIVE= 1 THEN 'ACTIVE' ELSE 'INACTIVE' END AS ACTIVE, USER_ID, NRIC + '--' + NAME+ '(' + CONVERT(VARCHAR,
ACTIVE) + ')' AS NRICNAME FROM M_USER ORDER BY NRIC -- Column ACTIVE is of type bit. NRICNAME is used in the listbox as datatextfield The
Current Output from the current code in the listbox is as follow, 123--Ben(0) 124--Andy(1) The
Desired Output in the listbox is as follow, 123--Ben(ACTIVE) 124--Andy(INACTIVE) Apparantly, The CASE is not working.
FiRer
Member
90 Points
18 Posts
Data Manipulation
Aug 02, 2003 02:53 AM|LINK
JBelthoff
Member
553 Points
135 Posts
Re: Data Manipulation
Aug 02, 2003 04:51 AM|LINK
SELECT CASE When Status = 1 Then 'Active' ELSE 'Inactive' END As STATUSNAME FROM M_USER:) JBDodge, Duck, Dip, Dive & Dodge
If a man can dodge a wrench, he can dodge a ball!
FiRer
Member
90 Points
18 Posts
Re: Data Manipulation
Aug 04, 2003 03:38 AM|LINK
JBelthoff
Member
553 Points
135 Posts
Re: Data Manipulation
Aug 04, 2003 05:45 PM|LINK
SELECT CAST(USER_ID As Varchar) + '--' + NAME + '(' + CASE WHEN ACTIVE= 1 THEN 'ACTIVE' ELSE 'INACTIVE' END + ')' As NRICNAME FROM M_USER:-D Enjoy! JBDodge, Duck, Dip, Dive & Dodge
If a man can dodge a wrench, he can dodge a ball!
FiRer
Member
90 Points
18 Posts
Re: Data Manipulation
Aug 06, 2003 06:28 AM|LINK