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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Change a number to a word
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

laurillo87
Starting Member

Mexico
4 Posts

Posted - 04/15/2014 :  13:39:27  Show Profile  Reply with Quote
Hello

I want to change a number to a word, let me show my query

SELECT Ready, Tired FROM PEOPLE

the table is like these

Ready Tired
1 0
0 1

I need to write in the table result a Yes for 1 and No for 0

the table have to be like these

Ready Tired
YES NO
NO YES

Some here know if what i want to do it's posible?

djj55
Constraint Violating Yak Guru

USA
352 Posts

Posted - 04/15/2014 :  13:45:33  Show Profile  Reply with Quote
In this case you can use the CASE statement
SELECT CASE Ready WHEN 1 THEN 'TRUE' ELSE 'FALSE' END AS Ready, CASE Tried WHEN 1 THEN 'TRUE' ELSE 'FALSE' END AS Tried FROM PEOPLE


djj
Go to Top of Page

laurillo87
Starting Member

Mexico
4 Posts

Posted - 04/15/2014 :  13:58:35  Show Profile  Reply with Quote
djj55, thank you very much, thats the solution, It worked as I needed

quote:
Originally posted by djj55

In this case you can use the CASE statement
SELECT CASE Ready WHEN 1 THEN 'TRUE' ELSE 'FALSE' END AS Ready, CASE Tried WHEN 1 THEN 'TRUE' ELSE 'FALSE' END AS Tried FROM PEOPLE


djj

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000