Groups | Blog | Home
all groups > sql server reporting services > november 2004 >

sql server reporting services : return all rows


JIM.H.
11/1/2004 2:14:02 PM
Hello,
Here is my query for my report. Can you make this query fetch all rows if
@myID parameter is null?

SELECT FName, MName, LName, ID
FROM MyTable
WHERE (ID = @myID) AND (myDate BETWEEN @StartDate AND @EndDate)

Thanks,
Jim.
NI
11/1/2004 2:36:01 PM
write a stored procedure and use an if condition

[quoted text, click to view]
JIM.H.
11/1/2004 2:47:02 PM
is it possible without stored procedure?

[quoted text, click to view]
Ruud
11/1/2004 10:18:14 PM
Hello Jim

Try to set your "is null" clause in the report settings itself

Ruud Boots
Holland

[quoted text, click to view]
Randy Howie
1/10/2005 5:31:02 PM
Here is a technique I like for the WHERE clause so that null means "all":

SELECT FName, MName, LName, ID
FROM MyTable
WHERE (ID = @myID or @myID is null)
AND myDate BETWEEN @StartDate AND @EndDate

I am currently trying to find how to pass a null parameter to a report. If
you know how to pass a null in RS, I would appreciate the feedback.

Thanks.

Randy Howie

--------------------------


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