DROP INDEX

The DROP INDEX statement removes an index from a table or view. The following script creates an index and then later drops it:

# Create the Social Security number index. 
CREATE UNIQUE INDEX idx_SSN ON Employees (SSN); 

# Work with the database for a while. 
... 

# Drop the Social Security number index. 
DROP INDEX Employees.idx_SSN; 

The DROP INDEX statement cannot remove the indexes built by PRIMARY KEY or UNIQUE constraints used when building a table. For example, it cannot remove the index named con_EmpId in the following script:

 # Create the Employees table. CREATE TABLE Employees ( EmployeeId NUMERIC CONSTRAINT con_EmpId UNIQUE NOT NULL, FirstName VARCHAR(50), LastName VARCHAR(50), etc. ); # Work with the database for a while. ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.