Solved

Help with a case statement

Posted on 2009-07-03
3
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

624 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