Dropping materialized views

When a materialized view is no longer needed, you can drop it.

Materialized view deletions and view dependencies

Before you can drop a materialized view, you must drop or disable all dependent views. To determine whether there are views dependent on a materialized view, use the sa_dependent_views system procedure. See sa_dependent_views system procedure.

See also View dependencies.

To drop a materialized view (Sybase Central)

  1. Connect to the database as a user with DBA authority, or as the owner of the view.

  2. In the left pane, double-click Views.

  3. Right-click the materialized view and choose Delete.

  4. Click Yes.

To drop a materialized view (SQL)

  1. Connect to the database as a user with DBA authority, or as the owner of the view.

  2. Execute a DROP MATERIALIZED VIEW statement.

Example

The following statement creates the EmployeeConfid4 materialized view, initializes it (populates it with data), and then drops it.

CREATE MATERIALIZED VIEW EmployeeConfid4 AS
   SELECT EmployeeID, Employees.DepartmentID, SocialSecurityNumber, Salary, ManagerID,
      Departments.DepartmentName, Departments.DepartmentHeadID
   FROM Employees, Departments
   WHERE Employees.DepartmentID=Departments.DepartmentID;
REFRESH MATERIALIZED VIEW EmployeeConfid4;
DROP MATERIALIZED VIEW EmployeeConfid4;
See also