Create a unique partition index on a SQL Server->> partition table

Source: Internet
Author: User

Today, while reading Oracle Advanced SQL Programming, there is a section in the chapter on global indexing of Oracle. If you create a unique index on a partitioned table, and the index itself is partitioned, you must also add the partition column to the index list, and certainly not the first column. Then I went to SQL Server and tried it. It's the same with Oracle. It is understandable to see later chapters. Because if the table is partitioned, it is actually each partition equals an index tree. This is why each partition corresponds to a hobt_id in this sys.partitions system view under SQL Server.

CreatePartitionfunctionPf_one_fifty_onehundred (INT) asRANGE Left  for VALUES(1, -, -)GOCREATEPARTITION SCHEME ps_one_fifty_onehundred asPARTITION pf_one_fifty_onehundred to([PRIMARY],[PRIMARY],[PRIMARY],[PRIMARY]);GO--DROP TABLE dbo.partition_testCreate Tabledbo.partition_test (col1INT, col2INT)  onps_one_fifty_onehundred (col1)GOCREATE UNIQUE INDEXUix_partition_test_col1 onDbo.partition_test (col1) onps_one_fifty_onehundred (col2); MSG1913, Level  -, state1, line *The operation failed because anIndex or Statistics  withName'Uix_partition_test_col1'Alreadyexists  on Table 'dbo.partition_test'.

Create a unique partition index on a SQL Server->> partition table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.