question

nikhilgsg avatar image
nikhilgsg asked

Partition a table

I have an existing table Employee (id--pk,name,age) --- sample to test partition before production I want to partition it with age.... CREATE PARTITION FUNCTION [MyFivePartition] (int) AS RANGE LEFT FOR VALUES (32,35) CREATE PARTITION SCHEME [psSample] AS PARTITION [MyPartition] TO ([PRIMARY],[PRIMARY]) ALTER TABLE dbo.Employee ADD CONSTRAINT Age --? PRIMARY KEY CLUSTERED (Age) --? ON psSample(Age) Cant get alter statement as I dont want Age to be a part of pk
sql server 2014
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sjimmo avatar image
sjimmo answered
If the age field is what you are using for your partition, then you will have to include it in your alter table statement just as you show it. Otherwise the PK will not be partitioned.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nikhilgsg avatar image nikhilgsg commented ·
Thanks IT answers my query
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.