I've got a problem in converting a table into a partitioned table.
I have a table of the following simple structure:
[font="Courier New"]CREATE TABLE dbo.orders (
OrderID int identity(1,1),
OrderDate datetime NOT NULL,
OrderAmount money NOT NULL
CONSTRAINT pk_orders PRIMARY KEY CLUSTERED (OrderDate,OrderID))[/font]
I'd like to convert it into a partitioned table by its ORDERDATE column.
I've succesffully create the partition funcation and scheme.
The following link:
http://msdn.microsoft.com/en-us/library/ms175864.aspx
suggests using CREATE INDEX, so I did the following:
[font="Courier New"]
CREATE clustered index pk_orders ON [dbo].[orders]([OrderDate] ASC, [OrderID])
WITH (DROP_EXISTING = ON )
ON partscheme(OrderDate)[/font]
I've got the following error:
[font="Courier New"]Msg 1907, Level 16, State 1, Line 2
Cannot recreate index 'pk_orders'. The new index definition does not match the constraint being enforced by the existing index.[/font]
How can I convert the index clustered table into a partitioned table?
SQL Server 2008 on Windows 2003 Server