Wrox Programmer Forums
|
BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7
This is the forum to discuss the Wrox book Professional SQL ServerReporting Services by Paul Turley, Todd Bryant, James Counihan, George McKee, Dave DuVarney; ISBN: 9780764568787
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2006, 01:18 PM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to allow NULLS in a dataset parameter

Hello,
I am relatively new to Reporting Services. My problem is to retrieve all rows if a parameter is left blank. This works fine for single input parameters like date, string, etc. by checking the checkbox in the report parameters properties.
However, if I have a parameter that is coming from a dataset, it doesn't display the 'null' checkbox even if I select the "Allow null value" checkbox. Does anyone know of a workaround or solution to this?
Any help is appreciated.

 
Old February 16th, 2006, 02:44 PM
Wrox Author
 
Join Date: May 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

SELECT ...
FROM ...
WHERE MyColumn = @MyParam OR @MyParam IS NULL


This will return all rows if the parameter value is null.

Paul Turley, MCSD, MCDBA, MCT, MSF Practitioner
 
Old February 16th, 2006, 02:48 PM
Wrox Author
 
Join Date: May 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Appologies.. I didn't read your question thoroughly. You'll need to include a row in the result set conaining a null value - such as:

SELECT NULL AS ID, '(All)' AS Description
UNION
SELECT ID, Description FROM WhatEver

Paul Turley, MCSD, MCDBA, MCT, MSF Practitioner
 
Old February 16th, 2006, 03:02 PM
Registered User
 
Join Date: Feb 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your solution. I think the 2nd one works best even though it is not the most elegant one.







Similar Threads
Thread Thread Starter Forum Replies Last Post
IN and NULLs joxa83 SQL Server 2005 8 September 29th, 2008 03:03 AM
insert nulls using a typed dataset humour ASP.NET 2.0 Professional 3 April 16th, 2008 05:17 AM
WHERE Clause, LIKE, and Nulls jurio SQL Language 5 May 28th, 2007 02:53 AM
looking for nulls Warbird C# 4 July 1st, 2004 07:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.