From the Profiling perspective of the studio, you can query and browse a selected database using the SQL Editor and then to store these SQL queries under the Source Files folder in the DQ Repository tree view. You can then open the SQL Editor on any of these stored queries to rename, edit or execute the query.
Prerequisite(s): You have selected the Profiling perspective in the studio.
To create an SQL query, do the following:
In the DQ Repository tree view, expand Libraries.
Right-click Source Files and select New SQL File from the contextual menu. The [New SQL File] dialog box is displayed.
In the Name field, enter a name for the SQL query you want to create and then click Finish to proceed to the next step.
The SQL Editor opens on the new SQL query.
If the Connections view is not open, use the combination Window > Show View > Data Explorer > Connections to open it.
Enter your SQL statement in the SQL Editor.
From the Choose Connection list, select the database you want to run the query on.
On the SQL Editor toolbar, click to execute the query on the defined base table(s).
Data rows are retrieved from the defined base table(s) and displayed in the editor.
A file for the new SQL query is listed under Source Files in the DQ Repository tree view.
Right-click an SQL file and from the contextual menu select:
open the selected Query file
create a copy of the selected Query file
Rename SQL File
open a dialog box where you can edit the name of the query file
Open in Data Explorer
open in the data explorer the SQL editor on the selected query file
delete the query file
The deleted item will go to the Recycle Bin in the DQ Repository tree view. You can restore or delete such item via a right-click on the item. You can also empty the recycle bin via a right-click on it.
When you open a query file in the SQL Editor, make sure to select the database connection from the Choose Connection list before executing the query. Otherwise the run icon on the editor toolbar will be unavailable.
When you create or modify a query in a query file in the SQL Editor and try to close the editor, you will be prompted to save the modifications. The modifications will not be taken into account unless you click the save icon on the editor toolbar.