SSRS - Blank parameter

Posted on 2009-04-21
Last Modified: 2012-05-06
Hi there,
I have a parameter in a report @postcode. What I would like is for the report user to enter the first x characters of the postcode and the report use that entery to filter results. I have that working no problem with

j.postcode like @PostCode + '%' in the stored procedure

What I would like is the option for the report user to leave this parameter option blank, and the report return ALL values. Any help is appreciated,

Question by:Rogero
    LVL 8

    Accepted Solution

    You need to allow nulls for Postcode value on RS form (Report > Report Parameters in BIDS) and also modify SP to set default for parameter and set logic in SP to show all results if parameter is NULL. In the dataset type ensure the CommandType is stored procedure.  
    CREATE PROCEDURE sel_Postcodes
    (@Postcode varchar(8) = NULL)
    IF (@Postcode IS NULL) 
    		SELECT * FROM Postcodes
    		SELECT * FROM Postcodes where Postcode LIKE @Postcode + '%'

    Open in new window

    LVL 8

    Expert Comment

    'Allow Blank Value' option will work with SP above  

    Author Closing Comment

    That's great, thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now