RENAME VIEW Command

Renames a SQL view in the current database.

RENAME VIEW ViewName1 TO ViewName2

Parameters

  • ViewName1
    Specifies the name of the SQL view to be renamed.
  • ViewName2
    Specifies the new name of the SQL view.

Remarks

The database containing the SQL view must be opened exclusively and must be current before the SQL view can be renamed. To open a database for exclusive use, include EXCLUSIVE in OPEN DATABASE.

Example

The following example opens the testdata database. CREATE SQL VIEW is used to create a local SQL view named myview, which is created from a SELECT - SQL statement that selects all records from the customer table. RENAME VIEW is used to change the name of the view from myview to yourview.

The View Designer is displayed, allowing modify the newly renamed SQL view. After the View Designer is closed, the SQL view is erased.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')

CREATE SQL VIEW myview AS SELECT * FROM customer  && Create the view
RENAME VIEW myview TO yourview  && Change the view name
MODIFY VIEW yourview  && Open the View designer
DELETE VIEW yourview  && Delete the view

See Also

CREATE SQL VIEW | DELETE VIEW | DISPLAY VIEWS | LIST VIEWS | MODIFY VIEW | OPEN DATABASE | RENAME VIEW | SELECT - SQL | USE