SSRS - Can I see the SQL statement from the Preview tab?

  • I am having a terrible time getting my SQL statement working for a report. I have 5 parameters and I get a syntax error in my SQL when I run the report from the Preview tab in Business Intelligence. Is it possible to "see" the exact SQL that is running at the point I run my report? That is, the SQL statement with the actual values from my parameter selection?

    Thanks,

    Bob

  • Something I have done in the past is create a copy of the report.

    Change my Query in the data set to something like.

    Declare @stmt varchar(max)

    set @stmt='Select * from table'

    Select @stmt

    Then on the report I add a text field to display @stmt.

    The hitch here is getting the syntax write. you obviously have to add the parameters outside the single quotes so they get fed in but you can combine them with the string. you may also have to convert the parameters to add them to a string.

    Hope this make sense.

    Dan

    If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.

  • Hi,

    Will you be able to use Profiler? , If so please.

    Thanks & Regards,
    MC

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

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