Generate Code

WinSQL’s Generate Code function allows users to quickly generate one of the following SQL scripts:

·Select

·Insert

·Update

·Delete

·Create View

·Drop Table

Once selected, the script displays in the Query window. The primary keys in the selected table are, by default, used as parameter fields in the script and are indicated by a double colon (::).

Note: The parameter field indicator can be modified, if desired. For more information, see the “General Tab” topic in Chapter 3, Configuration Options.

Perform the following steps to use the Generate Code function:

1Start WinSQL Professional and connect to the desired database.

2Click the plus (+) sign by Tables to view a list of tables in the catalog tree of your database.

3Click to select the desired table, and then right-click to display the submenu.

4Click Generate Code. A window similar to the following displays:

1Click the desired script.

The content of the selected script displays in the Query window. In the following example, the SELECT statement was generated, and the primary key for the table (c_id) is the parameter field:

Notes:

·Parameter fields can be removed from the script as desired.

·When generating a new script, the highlighted content of the existing script displayed in the Query window is overwritten.

If the cursor is positioned within the content of an existing script when a new script is generated, the new script is pasted at the current cursor position.

1Click the Execute queries icon () to run the script.