Parameter without declaring

  • Hi,

    I want to use the below query in the SSRS report.

    It is throwing error you must use declare statement. If I use declare it is not taking. How can we do this?

    select a.ID, b.name, c.date

    from table a

    join table b

    on a.id=b.id

    join tablec

    on b.name=c.name

    where a.ID=@ID

    If I remove the where a.id=@ID and select the dataset properties and choose parameter what is the parameter name and what is the parameter value I have to enter

    Immediate response is very helpful

    and it should work for multiple ids

  • If you base the report on a stored procedure (with the parameters already declared), SSRS creates the corresponding report-level parameters for you.

    Otherwise, you would have to create your own parameter and use the Filter property (or whatever it's called) of the report to filter the dataset. The advantage of doing it in the Stored Procedure is that the records that don't match are "discarded" inside SQL Server, not SSRS. (And why bring a ton of records you don't need?)

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

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