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
 General SQL Server Forums
 New to SQL Server Programming
 [SQL Gurus] How to define a search parameter value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

precision340
Starting Member

USA
2 Posts

Posted - 11/08/2013 :  12:37:42  Show Profile  Reply with Quote
I'm working on a SQL report and am returning a list of values for a column/field, "STATUS", to be used as one of the search parameter.

SELECT DISTINCT STATUS FROM [table]
ORDER BY STATUS

Values returned are [blank], approved, onhold, etc.

How can I get the [blank] value to be set as "All" within the report parameter for STATUS?

Thanks for any help! Much appreciated.

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 11/08/2013 :  12:40:56  Show Profile  Reply with Quote
Are you asking how you pass a value of ALL from your report? Or do you want to replace a blank value with the string value "All" when selecting from your table?

Here are some links about how to ask you question so that we can help you better:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

precision340
Starting Member

USA
2 Posts

Posted - 11/08/2013 :  12:52:17  Show Profile  Reply with Quote
I want to replace a blank value with the string value "All".
Go to Top of Page

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 11/08/2013 :  13:44:25  Show Profile  Reply with Quote

CASE WHEN Status = '' THEN 'All' ELSE Status END

--or

COALESCE(NULLIF(Status, ''), 'All')

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.08 seconds. Powered By: Snitz Forums 2000