Report Builder (Stored procedure)

  • Hi I am trying to call a stored procedure into report builder. The stored procedure has 2 parameters. When I run the report with allowing nulls and blank value in the parameters it works fine, but when I enter a value in a parameter it ignores the where clause I had in the original query(stored procedure) and displays everything. I am not sure what am I doing wrong here..may be nyone of you had this situation before.

  • Here's my stored procedure:

    (

    @UserFirstName AS varchar(20) = Null,

    @EventSource AS varchar(30) = Null

    )

    Where

    al.audit_event_id = '1234'

    @UserFirstName IS NULL OR UR.first_name Like '%' + @UserFirstName + '%'

    @EventSource IS NULL OR al.event_source LIKE '%' + @EventSource + '%'

    When I run the following without parameters it runs fine:

    EXEC USP_AppTrack_ByUser_ByEventSource

    When I run with the parameters, it ignores the al.audit_event_id = '1234'

    EXEC USP_AppTrack_ByUser_ByEventSource @UserFirstName = 'Love'

  • There are no records in the system with an al.audit_event_id = '1234' that have a first name like "Love"????

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • Thank you Michael, I figured it out. I was just missing some brackets.

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

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