Setting Templates Preferences

Create new SQL templates and edit existing ones. Templates make code generation more convenient by allowing you to insert frequently recurring source code patterns into your projects in SQL Editor.

SQL Editor Templates Preferences

FieldExplanation

Template list

Displays the existing templates in your workspace.

Preview

Displays the first few lines of the SQL template. To edit, click Edit.

New

Displays the Edit Templates dialog (see below), where you create a new template. New templates are added to the list.

Edit

Displays the Edit Templates dialog (see below), where you edit the selected template.

Remove

Deletes all selected templates.

Restore Removed

Restores removed default templates.

Revert to Default

Reverts the selected template to its default state.

Import

Imports templates into your workspace from the file system.

Export

Exports all selected templates to a specified location in the file system.

When you click New or Edit, the Edit Template dialog is displayed, where you create a new template or edit an existing one.

Edit Templates Dialog

FieldExplanation

Name

Enter the name of the template, for example, case.

Context

Determines where the template can be used and the set of available predefined template variables (see Template Variables below).

  • SQL — Generic SQL context

  • SQL-ASA — ASA SQL context

  • SQL-ASE — ASE SQL context

  • SQL-ASIQ — Sybase IQ SQL context

  • SQL-ASE15 — ASE 15 SQL context

  • Replication Server — Replication Server context

Automatically insert

Insert the template automatically when editing in this context. (Default)

Description

Enter descriptive text to be displayed in the Description column on the Templates preferences screen.

Pattern

Enter the template pattern.

Insert Variable

Displays a list of predefined context-specific variables, depending on what you chose from the Context menu.

For complete information on variables displayed in each context, see the Template Variables table below.

Clicking Insert Variable lets you use any of the following variables in your SQL template.

Explanation of template variables

FieldExplanation

${cursor}

Specifies the initial cursor position upon insertion of the template.

${cursor_name}

Evaluates to the cursor name used in SQL statements.

${date}

Evaluates to the current date.

${dollar}

Evaluates to the dollar symbol ($).

${line_selection}

Evaluates to the selected lines.

${time}

Evalutes to the current time.

${user}

Evaluates to the current system user name.

${word_selection}

Evaluates to the selected word.

Preferences

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com