Share via


Modifying, Renaming, and Deleting Views

You can modify existing views in the View Designer using the Project Manager or the Visual FoxPro language.

To modify a view in the View Designer

  • In the Project Manager, select the name of the view, and then choose Modify to open the View Designer.

    -or-

  • Open a database and use the MODIFY VIEW command with the name of the view.

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 

You can also modify the SQL statement for the view. For more information, see Creating Views.

Tip   To programmatically create a view, you can open an existing view, copy the SQL string, and paste it into your code.

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

  • In the Project Manager, select a database, and then the view name, and then choose Remove.

    -or-

  • Use the DELETE VIEW or DROP VIEW command.

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

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