Defining Queries with the SQL Editor

You can use the editing features of the SQL Editor to define a query. The SQL Editor dialog box is divided into specific panes containing the information shown below:

Information

Pane location

Objects types

Upper left part of the dialog box

Available objects

Upper right part of the dialog box

Query script textbox

Lower part of the dialog box

The list of available objects depends on the selected object type. You can select individual objects from the list of available objects for insertion in the query script textbox.

You can also define expressions by entering basic arithmetic operators such as add, subtract, multiply, divide (+, -, *, /) and with the syntax tools shown below:

Syntax tool

Content

Functions

Provides group, number, string, date, conversion and other functions

Operators

Provides logical operators

Variables

Provides variables for use with operators and functions

Macros

Provides macros to accelerate the creation of a template item definition

These syntax tools allow greater flexibility in defining complex expressions.

The SQL Editor can be used for the following tasks:


  • Defining a query for a view, a procedure, a trigger

  • Defining a computed column

For more information on defining views, see Creating, Editing, and Deleting Queries Associated with Views.

For more information on defining computed columns, see Creating a Computed Column.

  1. Click the query script textbox where you want to insert the SQL script.
  2. Select an object type from the upper left part of the dialog box.

    For example, select Tables to display the list of available tables. The list of available objects of this type is displayed in the upper right part of the dialog box.

  3. Double-click the available object that you want to add to the script.

    The item is added to the query script.

  4. Select a function or an operator to add to the script from the Function or Operator lists.

    The item is added to the query script.



  5. Click OK.


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com