SQL Utility Execute SQL Example

This topic contains information about the legacy SQL Utility, which is being phased out from GainSeeker Suite. It is still available for use in version 8.3, but is being replaced by the new GainSeeker SQL Utility function in the GainSeeker Utility module.

Using Execute SQL to view results of SQL queries

This utility can be used to execute SELECT, UPDATE, INSERT, and DELETE SQL statements. If the command executed is a SELECT command, the grid will show the data and the bottom textbox will display the number of records selected  If the command executed is a DELETE, UPDATE, or INSERT command, the grid will be empty and the bottom textbox will display the number of records affected.  

When selected, this option will bring up a warning dialog and then it will bring up the following dialog.


The top third of the dialog contains a textbox where you can type the SQL statement.  The middle third of the dialog contains a grid that displays the results. The bottom is a read only textbox to display messages.  These sections can be resized when the mouse is positioned over a divider (splitter) and dragged.

The results grid also has a popup menu, which contains Select All and Copy menu items.  The toolbar has buttons for Execute, Syntax Check, Close and Help commands. The buttons also have tool-tips for each of these commands.  
 

Following is an example of executing a query that returns results using the SQL Utility:

1. From the SQL utility file menu, select “Execute SQL Command”.  

2. Type the SQL statement in the textbox and click the Syntax Check button on the toolbar.  In this case we have typed “SELECT * FROM C:\GainSeek\Version7\Data\Tour\Vdata WHERE PARTNO = ‘A-50RB Length’”

3. Click the Execute button on the toolbar.
 



SQL Scripts can be saved and loaded into the SQL text box.  Click the File, Load menu to load a script file.  Click the File, Save As menu to save a script file.

For more information on using SQL Commands see Sample SQL Statements.