Using Crystal Reports designer, you can go to the “Database” menu and select “Show SQL Query” to see the exact SQL that will be used for the report based on your design. How can you see this SQL Query using .rpt Inspector on one or multiple reports?
.rpt Inspector has a property called “SQLQueryString” which is part of the Report object and is therefore shown for objects in “Reports” tab.
Open your Crystal Reports in .rpt Inspector
By default you’ll be on the “Reports” tab of the “Objects” pane (bottom pane) – click here for a visual explanation of the .rpt Inspector user interface
The grid on the “Reports” tab shows rows of objects. Click on one or more rows to have the properties exposed for the selected object(s) in the “Properties” pane (top middle pane)
Scroll through the list of properties in the “Properties” pane (top middle pane) until you get to the “Database” section – you’ll see listed there a property called “SQLQueryString”.
If the value of the property is blank, then you need to enable “Allow Dynamic Generation of SQLQueryString” in .rpt Inspector. See below explanation.
Allow Dynamic Generation of SQLQueryString explanation:
The SQLQueryString property is dynamically generated. Meaning that .rpt Inspector will need to make a connection to the Crystal Report’s database to generate the value properly.
By default, the dynamic generation of the SQLQueryString is disabled to increase performance. Since .rpt Inspector doesn’t need to connect to the Crystal Report’s database when working with various objects and properties (only for preview and making changes to the data source / database) this setting off by default.
To turn on the dynamic generation of the SQLQueryString, you’ll need to go to the “Tools” menu, and select “Options” from there. You’ll then see on the “Display” tab an option to turn on “Allow Dynamic Generation of SQLQueryString”.
Once enabled, if your Crystal Reports contain parameters, you’ll be prompted to provide values for them and .rpt Inspector will connect to each Crystal Report’s database – so you may also be prompted to provide login information as needed.