When I get asked the same question more than 3 times in less than 48 hours, I guess it’s time to create some documentation around the error.
The issue is when you click on the UniqueStatements link in the ReadTrace_Main report in SQL Nexus, you get the following exception:
If you collect a profiler trace, you will find that the error is raised while executing the following command:
exec ReadTrace.spReporter_StmtTopN @StartTimeInterval, @EndTimeInterval, @TopN, @Filter1, @Filter2, @Filter3, @Filter4, @Filter1Name, @Filter2Name, @Filter3Name, @Filter4Name
The error message would be:
Error: 137, Severity: 15, State: 2
Must declare the scalar variable "@StartTimeInterval".
The above error will be reported in the exception message that is raised in SQL Nexus as well. The issue is not with SQL Nexus but with the RML Utilities report. You can get this issue under the following condition:
1. There are no entries in the readtrace.tblStatements and readtrace.tblTimeIntervals tables.
2. Or if you are using an older version of ReadTrace (RML Utilities)
I was able to reproduce the issue on ReadTrace.exe build of 9.01.0109.
The issue stems from the fact that when you click on the UniqueStatements report link and no parameters are specified, the Start Time and the End Time to be analyzed is picked up from the tblTimeIntervals. I was able to reproduce the issue on the same SQL Nexus database using one version of ReadTrace reports and not with the other. You can send an email to email@example.com and request the latest build for RML Utilities with the ReadTrace and SQL Nexus log file as attachments. The logs can be retrieved by clicking on the hyperlinks in SQL Nexus shown in the picture on the right.