How to DROP a Index in SQL

In this article I am going to explain how to DROP a index in SQL.
  • 1947

Introduction

Index in SQL is used to quickly access the data from table or view. Indexes are created on table or view. Database have large amount of data like thousands of tables and view. When we try to access this data it takes more time.

SQL provide a way known as index through we can access a specific data quickly. CREATE INDEX statement is used to create a index.

Type of index in SQL

  • Clustered index
  • Non clustered index
  • Unique index
  • Columnstore index

How to Drop a Index

DROP INDEX statement is used to drop a index.

Statement that create index

USE vipendra

GO

-- Create a new table with three columns.

CREATE TABLE dbo.studentinfo

    (s_id int NOT NULL,

     s_name nchar(10) NULL,

     s_address nvarchar(50) NULL);

GO

-- Create a clustered index called student_index

-- on the dbo.TestTable table using the TestCol1 column.

CREATE CLUSTERED INDEX student_index

    ON dbo.studentinfo (s_id);

GO

Statement that drop index

USE vipendra;

GO

-- delete the student_index index

-- from the dbo.student table

DROP INDEX student_index

    ON dbo.studentinfo

GO


© 2020 DotNetHeaven. All rights reserved.