Viewing the SQL Generated by a Query

When you build a query in Web Intelligence, Web Intelligence generates SQL to run against the database to return the query result. S(tructured) Q(uery) L(anguage) is the query language understood by all relational databases.

You can view and edit the SQL generated by Web Intelligence.

Note.pngYou cannot view the SQL of queries that call database stored procedures.

To view and edit the generated SQL

Note.pngYou cannot edit the query SQL when the query contains optional prompts. Edit the query to remove the optional prompts before attempting to edit the SQL.

1.    Click SQL on the query toolbar to display the "SQL Viewer" dialog box.
When SQL is not editable, values supplied in response to prompts appear directly in the query.
For example, if "UK" was supplied in response to a prompt on [Country], a line similar to
image4.gif
appears in the query.
If no value has yet been supplied for the prompt, the Web Intelligence syntax for prompts (described below) appears in the query.

2.    Click Use custom SQL to make the generated SQL editable.
When you make the SQL editable, the Web Intelligence syntax for prompts appears in the query.
For example, a line similar to
image1.jpg
appears in the query.

3.    Click Validate after editing the SQL to check that your edits are valid.

4.    Click Copy (Java Report Panel and Web Intelligence Rich Client only) to copy the SQL to the clipboard.

5.    Click Print (Query - HTML only) to print the SQL.