Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Select query case statement

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-07-24 : 10:28:34

I want to use the following case in the select, is it possible:
I am getting errors incorrect syntax...


 
select u.userid, u.LastName, u.FirstName, u.UserName,
u.Enterpriselevelaccess, u.Division, div.div_name,
u.title, u.company, u.email, ur.userrole,

CASE u.RMSAccess
WHEN 0 THEN 'None'
WHEN 1 THEN 'Read'
WHEN 2 THEN 'Edit'
ELSE ''
END as RMSAccess

from tab_users U inner join tab_userroles UR on (u.userid= ur.userid)
inner join tab_divisions Div on ( u.division = div.divisionid )
where u.deleted=0 and 65 in (select userid from tab_userroles where userRole =1) order by 2,3,1


Thank you very much for the helpful info.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-24 : 10:31:29
Yes, are you getting an error and if so, what is it?
Go to Top of Page

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2009-07-24 : 10:33:24
No, it is working thanks...
Go to Top of Page
   

- Advertisement -