HOW TO DROP UNIQUE NON CLUSTERED INDEX

  • I AM HAVING A " UNIQUE NON CLUSTERED INDEX  " ASSOCIATED WITH 3 COLUMNS. NOW WE HAVE DECIDED TO REMOVE ONE OF THE COLUMN FROM THE TABLE.

    1: WHAT ARE THE THINGS WE NEED TO CONSIDER BEFORE DROPING THIS UNIQUE NON CLUSTERED INDEX.
    2: WHAT IS THE SYNTAX FOR DROPING THIS UNIQUE NON CLUSTERED INDEX

    PLEASE HELP , THANKS .

  • Clustered index is the table, so you might want to recreate the index without the column, or you will end up with a heap table.
    Since it is a Unique index, chances are that it is a key, so be aware of any relations, business rules etc that are impacted.

    Apart from above this is a normal operation that you can go ahead and do, take backups and make sure recreating index might require some additional temporary storage, especially if you are having a large table.

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • NISHANTHKANNUR - Thursday, February 16, 2017 11:06 PM

    1: WHAT ARE THE THINGS WE NEED TO CONSIDER BEFORE DROPING THIS UNIQUE NON CLUSTERED INDEX.

    No need to SHOUT!

    Do you intend to recreate the index after dropping the column from the table?  If so, you will need to consider whether the index is still unique without it.  If it isn't, you'll either need to find another column that makes the index unique, or recreate the index as non-unique.

    John

  • joeroshan - Friday, February 17, 2017 2:15 AM

    Clustered index is the table, so you might want to recreate the index without the column, or you will end up with a heap table.

    OP asks about a unique nonclustered index

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster - Friday, February 17, 2017 2:35 AM

    joeroshan - Friday, February 17, 2017 2:15 AM

    Clustered index is the table, so you might want to recreate the index without the column, or you will end up with a heap table.

    OP asks about a unique nonclustered index

    oops! sorry I read it wrong. Thanks Gail for notifying this.

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • John Mitchell-245523 - Friday, February 17, 2017 2:32 AM

    NISHANTHKANNUR - Thursday, February 16, 2017 11:06 PM

    1: WHAT ARE THE THINGS WE NEED TO CONSIDER BEFORE DROPING THIS UNIQUE NON CLUSTERED INDEX.

    No need to SHOUT!

    Do you intend to recreate the index after dropping the column from the table?  If so, you will need to consider whether the index is still unique without it.  If it isn't, you'll either need to find another column that makes the index unique, or recreate the index as non-unique.

    John

    Sorry for posting in caps
    Thanks for the reply. I need to recreate it and it should be unique again. So I will check if it still unique without that column or I will find another column.
    Thanks again.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply