title: How to add PARTITION to an existing table with primary clustered index
body: <p>I want to add PARTITION to an existing table with a primary clustered index, but I don't know the way:</p>
  
  <pre><code>CREATE TABLE [dbo].[AppUsers]
  (
      [Id] [uniqueidentifier] NOT NULL,
      [UserName] [nvarchar](max) NULL,
      [NormalizedUserName] [nvarchar](max) NULL,
      [Email] [nvarchar](max) NULL,
      [NormalizedEmail] [nvarchar](max) NULL,
      [EmailConfirmed] [bit] NOT NULL,
      [Status] [int] NOT NULL,
      [UserType] [int] NOT NULL,
      [CompanyId] [int] NULL,
      [RoleLevelId] [nvarchar](450) NULL,
      [JobCategoryId] [int] NULL,
      [PerfectureId] [int] NULL,
      [CompanySizeId] [int] NULL,
      [DistrictId] [int] NULL,
      [DateCreated] [datetime2](7) NOT NULL,
      [CompanySizeId1] [int] NULL,
      [JobCategoryId1] [int] NULL,
      [PartitionValue] [int] NULL,
  
      CONSTRAINT [PK_AppUsers] 
          PRIMARY KEY CLUSTERED ([Id] ASC)
            WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, 
                  IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
                  ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] 
  ) ON [PRIMARY]  TEXTIMAGE_ON [PRIMARY] 
  GO
  </code></pre>
  
  <p>This is my scheme:</p>
  
  <pre><code>ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_2', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_2.ndf') TO FILEGROUP bf_2 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_4', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_4.ndf') TO FILEGROUP bf_4 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_6', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_6.ndf') TO FILEGROUP bf_6 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_8', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_8.ndf') TO FILEGROUP bf_8 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_10', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_10.ndf') TO FILEGROUP bf_10 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_12', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_12.ndf') TO FILEGROUP bf_12 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_14', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_14.ndf') TO FILEGROUP bf_14 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_16', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_16.ndf') TO FILEGROUP bf_16 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_18', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_18.ndf') TO FILEGROUP bf_18 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_20', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_20.ndf') TO FILEGROUP bf_20
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_22', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_22.ndf') TO FILEGROUP bf_22 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_24', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_24.ndf') TO FILEGROUP bf_24 
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'bf_26', FILENAME = N'C:\Users\Ruby\Desktop\partitest\bf_26.ndf') TO FILEGROUP bf_26
  ALTER DATABASE YayoiTest ADD FILE (NAME = N'af_26', FILENAME = N'C:\Users\Ruby\Desktop\partitest\af_26.ndf') TO FILEGROUP af_26
  
  USE YayoiTest
  GO
  CREATE PARTITION FUNCTION PFunc_NGD(int) AS
  RANGE RIGHT FOR VALUES (2,4,6,8,10,12,14,16,18,20,22,24,26)
  GO
  CREATE PARTITION SCHEME PScheme_NGD AS PARTITION PFunc_NGD
  TO (bf_2, bf_4, bf_6, bf_8, bf_10, bf_12, bf_14, bf_16, bf_18, bf_20, 
  bf_22, bf_24, bf_26, af_26)
  </code></pre>
  
  <p>and this is my partition column </p>
  
  <pre><code>[PartitionValue]
  </code></pre>
  
  <p>Can someone help me or give me some advice, I just start learning about partition table</p>