t-sqlsql-server-2008ssrs-2008

Simple Way to View SQL Query (ies) Generated by SSRS Reports?


Is there a simple way to view the SQL Queries actually generated by SSRS other than running profile traces to capture them?

Is there some way from within the BIDS editor to see this?


Solution

  • In short, no. There is no good workaround. However, for development I generally created a test query alongside my work in SSRS. I would edit this inside Management Studio and then just paste the values back into BIDS. Assuming two parameters named "StudentID" and "TeacherID", the query looked like:

    DECLARE @StudentID int
    DECLARE @TeacherID int
    
    SELECT @StudentID = StudentID FROM Students WHERE StudentName LIKE 'John Doe'
    SELECT @TeacherID = TeacherID FROM Teachers WHERE TeacherName LIKE 'Mr. Jones'
    
    -- PASTE IN QUERY FROM BIDS BELOW
    

    This allowed me to use real text values from the drop-down parameter lists and simply paste in my query. Then I could optimize the query in Management Studio and then paste it back into BIDS when I was happy with the result.