Collections:
DROP_EXISTING - Recreating an Existing Index in SQL Server
How To Recreate an Existing Index in SQL Server?
✍: FYIcenter.com
If you want to change the definition of an existing index, you can use the "DROP INDEX" statement to drop the index first. Then use the "CREATE INDEX" statement to create it again with the new definition.
But you can also combine those two statements into one:
CREATE INDEX ... WITH (DROP_EXISTING = ON)
The tutorial exercise below recreates fyi_links_url with a change to index columns:
USE FyiCenterData; GO CREATE INDEX fyi_links_url ON fyi_links_indexed (url, counts) WITH (DROP_EXISTING = ON); GO SP_HELP fyi_links_indexed; GO index_name index_description index_keys ---------------- -------------------------------- ------------ fyi_links_counts nonclustered located on PRIMARY counts fyi_links_url nonclustered located on PRIMARY url, counts
Â
2016-11-08, 1987👍, 0💬
Popular Posts:
How To Create a Dynamic Cursor with the DYNAMIC Option in SQL Server Transact-SQL? If the underlying...
Where to find Oracle database server tutorials? Here is a collection of tutorials, tips and FAQs for...
How To Start Instance with a Minimal Initialization Parameter File in Oracle? The sample initializat...
What Is a Database Schema in Oracle? A schema is a collection of logical structures of data, or sche...
Where to find answers to frequently asked questions on Storage Engines: MyISAM, InnoDB and BDB in My...