Export (0) Print
Expand All
Expand Minimize

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.

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.

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

Community Additions

ADD
Show:
© 2014 Microsoft