Using SQL Templates


Templates are files containing SQL scripts that help you use predefined code templates. Template files should be copied to a directory defined in Options->General->Templates. Files should be copied into one of the subdirectories of path specified in Options. Template files are ordinary text files containing SQL code. The template files can use formal parameters to help you customize the code. Template parameter definitions use following format:

<parameter_name, data_type, value>

where

Example:

CREATE PROCEDURE <procedure_name>
AS
BEGIN
END <procedure_name>;

Use the Replace Template Parameters dialog box to insert values into the script.

Note  You can use the Replace Template Parameters dialog box to specify values any time a parameter definition is used in code. For example, when you script execute function from Object View, the function written to the current Script window will contains parameter definitions for any arguments in the function. You can, therefore, use the Replace Template Parameters dialog box to specify argument values. Also if you have text selected in Editor and invoke Replace template Parameters dialog then only selection will be checked for any template parameters

It is possible to specify cursor position in template. Put symbol "^" anywhere in the template text.

 

To use template

  1. Open a Script window
  2. If template manager window is not visible press Manage SQL Templates button on the toolbar
  3. Navigate to desired template and select Insert Template menu item or double click left mouse button
  4. When the template is displayed in the Script window, select Replace Template Parameters button on the toolbar
  5. In the Replace Template Parameters dialog box, specify values for the parameters
  6. To insert the specified values into the script in the Editor, click Replace