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