SQL Server Forums
Profile | Register | 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
 New Topic  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
338 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  
 New 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