0

to enable incremental update statistics i have to create partition function, partition scheme, index on my table and create table in this way

    create table [tmp].[PartitionTest]
    (
        [RecordId] int not null 
        ,[CreateDate]  datetime
            ,[Quantity] int

    )  on [ups_partionByDate_scheme226] ([CreateDate])

But, when I can't create table like and add this line

on [ups_partionByDate_scheme226] ([CreateDate])

Can I do this by alter table or other way?

NewMe
  • 35
  • 1
  • 8
  • This [looks familiar](https://stackoverflow.com/q/55728320/4137916). The difference is that I don't quite understand what this question is trying to ask, as opposed to the other one. If you want to create incremental statistics after the fact, use `UPDATE STATISTICS ... WITH INCREMENTAL = ON`. – Jeroen Mostert Apr 24 '19 at 09:16

1 Answers1

0

Yes.

If your table has a clustered index, then you need to drop it and after that you can use the following code snippet. If you have no cluster index, skip the previous sentence.

ALTER TABLE [tmp].[PartitionTest] ADD CONSTRAINT [PK_ParitionTest_CreateDate] PRIMARY KEY CLUSTERED 
(
  [CreateDate]
) ON [ups_partionByDate_scheme226] ([CreateDate]);

See also Create Partitioned Tables and Indexes