Groups | Blog | Home
all groups > sql server reporting services > june 2006 >

sql server reporting services : Using "ALL" in Parameters


Benw
6/22/2006 1:13:02 PM
I am trying to use 'ALL" in my parameters but it doesnt seem to work. My
parameter dataset query looks like this:

SELECT Empid AS EMPLOYEE
FROM smServFault
WHERE (TaskStatus <> 'C')
UNION
SELECT 'ALL' AS EMPLOYEE
ORDER BY EMPLOYEE

and my main query looks like this:

SELECT smServCall.ShiptoId, smServFault.FaultCodeId, smServFault.Empid,
smServFault.TaskStatus, smServFault.StartDate, smServFault.WarrStart,
smServFault.Notes, smServFault.CauseID,
smServFault.ResolutionID, smServCall.ServiceCallCompleted,
smServFault.StartTime,
smServFault.Duration
FROM smServCall LEFT OUTER JOIN
smServFault ON smServCall.ServiceCallID =
smServFault.ServiceCallId
WHERE (smServFault.TaskStatus <> 'C') AND
(smServCall.ServiceCallCompleted = 0) AND (smServFault.Empid IN (@vendor))
AND
(smServFault.StartDate BETWEEN @date AND @enddate)
ORDER BY smServFault.StartDate

William
6/22/2006 1:47:01 PM
AND (smServFault.Empid IN (@vendor)) will not work because I assume there is
no 'All' in EmpId field.

Use AND (smServFault.Empid IN (@vendor) or @vendor IS NULL)

This is assuming that NULL is the value when you select 'All' as the
parameter.

[quoted text, click to view]
Benw
6/22/2006 1:51:02 PM
Actually that is where I was getting stuck, so I tried

smServFault.Empid IN @vendor or @vendor = "All"

and it worked.

[quoted text, click to view]
AddThis Social Bookmark Button