Learn more about Toad for SQL Server
at Dell Software

Find solutions and downloads at the
Toad for SQL Server Support Portal

Toad for SQL Server 6.6

You are here: Edit SQL > Reuse SQL > Add Toad Views

Add Toad Views

Toad Views give you a convenient way to save and reuse SQL queries. In addition to saving your queries in Toad like SQL Recall, Toad Views allow you to more-easily work with, customize, and organize your queries. Use Toad Views to save long and complex SQL to use as a starting point for querying. Or create your own "personal" database views to query against. This can be especially useful if you can't create your own views in the database itself. In addition, you can use Toad Views to save queries to reuse on different databases, such as on a development and a production database.

You can select a SQL query from the Editor, the Query Builder, or the SQL Recall pane and save it as a Toad View. The views are stored in Toad and accessed through the Toad Views manager. You can use the Toad Views manager to organize your views into folders, to create new views, and to modify current views.

To open the Toad Views manager

» Select View | Toad Views.

To save SQL as a Toad View

  1. Do one of the following:

  2. Enter a name for the Toad View.

    Note: To open the Toad Views manager after saving, select the Open Toad View Manger option.

To create a Toad View from the Toad Views manager

  1. Select View | Toad Views to open the Toad View manager.
  2. Right-click within the Toad View manager and select New Toad View.
  3. Rename the new view and press the Enter key to open an editor.
  4. Enter or paste SQL into the editor, or click to select a SQL file. Click to review the result set.

To use a Toad View

» In the Toad Views Manager, do one of the following:

Note: If the active window is not an Editor, double-clicking a view in the Toad Views manager opens a new Editor window containing the view.

Tip: Unlike code snippets, Toad Views contents are not pasted in the Editor. Toad View name in the curly brackets is replaced with view contents only during script execution. That means you can update Toad View any time without affecting script in the Editor.

Toad Views and bind variables

Toad Views are different than normal views in that Toad Views can contain bind variables. If you execute a Toad View that contains a bind variable, Toad will prompt you for a value.

Note: Toad allows you to store values for bind variables. Click in the Toad Views toolbar to open the Bind Variable dialog where you can manage your variable/value combinations. See Using Bind Variables for more information.

Important Considerations When Using Toad Views

Consideration Description
Using aliases in Toad Views If you use an alias name in a Toad View, you cannot use the same alias name in the parent query.

 

Tips:

  

Related Topics

 

of