• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

Help with a case statement

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
directxBOB
Asked:
directxBOB
3 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
select [user] , case when [user] = '' then 'false' when [user] IS NULL then 'false' else 'true' from [assets]
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
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
 
shru_0409Commented:
select user , case user when  user then 'TRUE' ELSE 'FALSE' end from assets

try this
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now