How to create default parameter for stored procedure dataset

  • I have a report that is going to be the body of a long email that contains statistics from our database (think form letter format). Each section of the report will have a different dataset. So, instead of creating a stored procedure for each section, I just created one stored proc that accepts a parameter telling it which part of the proc to run. My problem is that I can't figure out how to pass a default parameter to the stored proc in the SSRS dataset.

    If I try to pass it as part of the query string like I would in Management Studio, it gives me an error.

    I tried to set it in the Dataset dialog box (see pictures), but it still asks me every time I run it.

  • confused.

  • Add the default to the parameter in the stored procedure itself.

    CREATE PROCEDURE dbo.SomeProc

    Parameter1 INT, --This has no default

    Parameter2 VARCHAR(8000) = 'SomeValue' --This has a default of 'SomeValue'

    AS

    procbodyhere...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply