Solved

Easy SQL: Return 'Demo' or 'Live' - instead of True or Fals on bit field

Posted on 2007-03-30
4
669 Views
Last Modified: 2012-06-27
SQL Server 2000.

I have a bit field - that returns True of False (obviously) (eg SELECT mybitfield from mytable).

returns

True
False
True

How can I return, say, 'Demo' if true is returned - and 'Live' if false?

Thanks!...
0
Comment
Question by:jon100
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:auke_t
ID: 18822914
select
  case when mybitfield = 1 then 'Demo' else 'Live' end
from
  mytable
0
 

Author Comment

by:jon100
ID: 18823312
thanks.

one more quick thing - how can i get that to return a column heading?
0
 
LVL 9

Accepted Solution

by:
auke_t earned 125 total points
ID: 18823350
select
  case when mybitfield = 1 then 'Demo' else 'Live' end as MyColumnHeading
from
  mytable
0
 

Author Comment

by:jon100
ID: 18823930
excellent - thanks a lot
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now