Please start any new threads on our new site at 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!
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Imbedding If ..else in query
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

179 Posts

Posted - 09/01/2004 :  13:17:46  Show Profile
I have a query like:
Select Project_Code, Project_Name, L_Proj
from Projects

L_Proj is bit data type but I want to display it as text:
If L_Proj = 1 return 'Part of Larger Project'
If L_Proj = 0 return 'Independant Project'

Can I use if statement within the query to return what I want ??


Almighty SQL Goddess

38200 Posts

Posted - 09/01/2004 :  13:22:08  Show Profile  Visit tkizer's Homepage

SELECT Project_Code, Project_Name,
L_Proj = CASE WHEN L_Proj = 1 THEN 'Part of Larger Project' ELSE 'Independent Project' END
FROM Projects

Go to Top of Page

Posting Yak Master

179 Posts

Posted - 09/01/2004 :  13:32:20  Show Profile
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000