Share via


Modifying, Renaming, and Deleting Views

You can modify existing views in the View Designer using the Project Manager or the language. If you want to modify the view's SQL string programmatically, you must create a new view. You can then save the new view definition and overwrite the existing view name.

Tip   In the View Designer, you can open an existing view, and then copy the read-only SQL string and paste it in your code as a shortcut in creating a view programmatically.

To modify a view in the View Designer

In the View Designer, you can use the Query menu or the View Designer toolbar to add a new table to the view. The following code displays product_view in the View Designer:

OPEN DATABASE testdata
MODIFY VIEW product_view 

Renaming a View

You can rename a view from the Project Manager or with the RENAME VIEW command.

To change the name of a view

  • In the Project Manager, select a database, and then select the view name, and then choose Rename File from the Project menu.

    -or-

  • Use the RENAME VIEW command.

For example, the following code renames product_view to products_all_view:

RENAME VIEW product_view TO products_all_view

The database containing the view must be open before you can rename the view.

Deleting a View

You can delete a view definition from a database using the Project Manager or the DELETE VIEW command. Before deleting the view, make sure the database containing the view is open and set as the current database.

To delete a view

For example, the following code deletes product_view and customer_view from the database:

DELETE VIEW product_view
DROP VIEW customer_view

Note   These commands have the same effect; DROP VIEW is the ANSI SQL standard syntax for deleting a SQL view.

See Also

Creating a Local View | Creating a Multitable View | Creating Queries | Accessing Remote Data | Project Manager |