Home Forums SQL Server 2005 Development how to create unique nonclustered index on partitioned table without including partition column RE: how to create unique nonclustered index on partitioned table without including partition column

  • I know this thread is a couple of months old but I'm extremely sympathetic to this problem.

    According to Books Online (and I haven't actually tried it, yet), you CAN create a separate non-aligned unique index on a partitioned table. You will also lose the some of the advantages of partitioning the table. Of course, you also lose the extremely inconvenient problem of having to include the partitioning column in the index definition which {drum roll please} inherently makes the column non-unique (hell of a Catch 22 there). It also means that you don't have to change all of your FK's that may point to the table, either. The bad part (if you need such a thing) is that you can't (if I read Books Online correctly) do a SWITCH with such an index in place.

    My recommendation would be to dig deeper into all of the caveats of partitioning BEFORE you partition your tables using either PARTITIONED VIEWS or PARTITIONED TABLES because they can really mess things up for you if you haven't adequately planned or have missed one of the caveates of partitioning. Of course, I believe that bit of advice is way too late for the OP.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)