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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 [SQL Gurus] How to define a search parameter value

Author  Topic 

precision340
Starting Member

2 Posts

Posted - 2013-11-08 : 12:37:42
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
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-11-08 : 12:40:56
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

2 Posts

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

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-11-08 : 13:44:25
[code]
CASE WHEN Status = '' THEN 'All' ELSE Status END

--or

COALESCE(NULLIF(Status, ''), 'All')
[/code]
Go to Top of Page
   

- Advertisement -