Collections:
CREATE INDEX - Adding an Index on an Existing Table in SQL Server
How To Create an Index on an Existing Table in SQL Server?
✍: FYIcenter.com
If you want to an index on an existing table, you can use the CREATE INDEX statement in a simple syntax:
CREATE INDEX index_name ON table_name (column_name)
The tutorial exercise below shows you how to add an index for the "in" column of the "fyi_links" table:
USE FyiCenterData; GO -- Drop the old table, if needed DROP TABLE fyi_links; GO -- Create a fresh new table CREATE TABLE fyi_links ( id INT NOT NULL, url VARCHAR(80) NOT NULL, notes VARCHAR(1024), counts INT, created DATETIME NOT NULL DEFAULT(getdate()) ); GO -- Create an index for "id" CREATE INDEX fyi_links_id ON fyi_links (id); GO -- Create an index for "url" CREATE INDEX fyi_links_url ON fyi_links (url); GO
2016-11-15, 746👍, 0💬
Popular Posts:
How To Find Out What Privileges a User Currently Has in Oracle? Privileges granted to users are list...
How To List All Stored Procedures in the Current Database in SQL Server Transact-SQL? If you want to...
Where to find answers to frequently asked questions on Managing Security, Login and User in SQL Serv...
Where to find answers to frequently asked questions on Storage Engines: MyISAM, InnoDB and BDB in My...
How To Replace NULL Values in Expressions using ISNULL() in SQL Server Transact-SQL? As you learned ...