Home Forums SQL Server 2008 T-SQL (SS2K8) IF EXISTS DROP INDEX ... IF NOT EXISTS CREATE INDEX RE: IF EXISTS DROP INDEX ... IF NOT EXISTS CREATE INDEX
Lynn Pettis
SSC Guru
Points: 442467
More actions
August 13, 2012 at 2:21 pm
#1525270
I would say to create the index if it doesn't exist. Using the DROP EXISTING implies that the index already exists. We do it here to ensure that the script is rerunnable when creating new indexes, so use it when modifying existing as well.