Solved

Help with a case statement

Posted on 2009-07-03
3
206 Views
Last Modified: 2012-05-07
I have the following statement:

select user from assets

What I would like to do is have a case statement  where if it's an empty string then I return false, else I return true.

I can't seem to get it rght.

0
Comment
Question by:directxBOB
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 400 total points
ID: 24772009
select [user] , case when [user] = '' then 'false' when [user] IS NULL then 'false' else 'true' from [assets]
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 50 total points
ID: 24772138
i think Angel missed the 'End'

select [user] , case when [user] = '' then 'false' when [user] IS NULL then 'false' else 'true' End as Status
from [assets]
0
 
LVL 14

Assisted Solution

by:shru_0409
shru_0409 earned 50 total points
ID: 24772148
select user , case user when  user then 'TRUE' ELSE 'FALSE' end from assets

try this
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question