-1

For report purposes in SSRS I need an SQL query for one parameter which will select only one value or all values (not two or more). It's a single value parameter.

Well, my query should looks like this, but it didn't work:

SELECT ft.id, ft.name
FROM fundtable ft
UNION ALL
SELECT '11111111-1111-1111-1111-111111111111','All'

DECLARE @funds NVARCHAR(MAX)

SELECT @funds = COALESCE(CAST(entity_id AS NVARCHAR(255)),',')
FROM epev_conduit

SELECT @funds
Darko Milic
  • 189
  • 3
  • 13
  • 1
    not quiet sure what you're asking here. can you elaborate. – Tanner May 05 '15 at 15:02
  • i have one table with 6 fund names, and when I want to do report, i want report for one fund and that's easy, it's simple query, but I need to have option to chose all funds. – Darko Milic May 05 '15 at 15:11
  • possible duplicate of [SSRS: How to add All option to SSRS dropdown filter?](http://stackoverflow.com/questions/14893789/ssrs-how-to-add-all-option-to-ssrs-dropdown-filter) – Ian Preston May 05 '15 at 15:29

2 Answers2

0

If you are using this query for a dataset that your parameter is using for the Available Values, you don't need to put in into a string. Just use:

select ft.id, ft.name    
from fundtable ft
union all    
Select '11111111-1111-1111-1111-111111111111','All'

The use your Name field for the Label and your ID for the Value. You can Specify a Default value expression of

="11111111-1111-1111-1111-111111111111" 

if you want the default to be all.

Hannover Fist
  • 10,393
  • 1
  • 18
  • 39
0

This should do the trick.

SELECT *
FROM   dbo.YourTable
WHERE  @id = id 
       OR @id = '11111111-1111-1111-1111-111111111111'
Ray Krungkaew
  • 6,652
  • 1
  • 17
  • 28