Scenario: On table x, create a partition and create a clustered index.
When doing a schema compare, the script generated for a clustered index uses the INCLUDE keyword and is including columns from the partition. This is invalid. Clustered indexes cannot INCLUDE columns.
Expected result: Clustered indexes should not specify the INCLUDE columns syntax.
To reproduce the problem:
1. Create a partition and a table as follows.
CREATE PARTITION FUNCTION [myRangePF10] (int) AS RANGE LEFT FOR VALUES (1,100,1000)
GO
CREATE PARTITION SCHEME [myRangePS10] AS PARTITION [myRangePF10] TO ([test1fg],[test1fg],[test1fg],[test4fg])
GO
CREATE TABLE [dbo].[Part_Table_10] (
[col1] int NOT NULL,
[col2] int NOT NULL,
[col3] int NOT NULL
)
GO
2. Create a clustered index as follows. Note that the index column must be different than the partition column.
CREATE CLUSTERED INDEX [IX_TEST10]
ON [dbo].[Part_Table_10]([col3])
ON [myRangePS10] (col2)
GO
3. Script the index using the "CREATE (Full)" option.
IF NOT EXISTS (select 'exists' from sys.partition_functions where name = 'myRangePF10')
CREATE PARTITION FUNCTION [myRangePF10] (int) AS RANGE LEFT FOR VALUES (1,100,1000)
GO
IF NOT EXISTS (select 'exists' from sys.partition_schemes where name = 'myRangePS10')
CREATE PARTITION SCHEME [myRangePS10] AS PARTITION [myRangePF10] TO ([test1fg],[test1fg],[test1fg],[test4fg])
GO
CREATE CLUSTERED INDEX [IX_TEST10]
ON [dbo].[Part_Table_10]([col3])
INCLUDE ([col2])
ON [myRangePS10] (col2)
GO
Issue #8246 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build 31076 |
No time estimate |
Fixed in ADS-12.0.0, ADS-13.0.0, and trunk.