Prepare the test table first
CREATE TABLE [dbo]. [Employee] ( INTIDENTITY(1,1PRIMARYKEY , NVARCHAR (NULL);
Insert some data
INSERT DEFAULT VALUES ; GO 10000 UPDATE Set = ' '+CONVERT(VARCHAR
Creating filegroups
Create a file (for performance, you can set the file path to be distributed on different disk partitions)
Create partition Prep
Select a partition column
Create a partition function
Creating a partitioned Framework
Define boundary values, partitioning, because there are 5 boundary values, so 6 partitions are required
The resulting script file (in other words the above step is equivalent to the following statement)
Use [Testingdb]GOBEGIN TRANSACTIONCREATEPARTITIONFUNCTION [empfunction](int) asRANGE Right for VALUES(N' -'N'4000'N'6000'N'8000'N'10000')CREATEPARTITION SCHEME[Funscheme] asPARTITION[empfunction] to([FileGroup1],[FileGroup2],[FileGroup3],[FileGroup4],[FILEGROUP5],[PRIMARY])ALTER TABLE [dbo].[Employee] DROP CONSTRAINT [pk__employee__7ad0f1b633d4b598]ALTER TABLE [dbo].[Employee] ADD PRIMARY KEY CLUSTERED ( [Employeeno] ASC) with(Pad_index= OFF, Statistics_norecompute= OFF, sort_in_tempdb= OFF, Ignore_dup_key= OFF, ONLINE= OFF, Allow_row_locks= on, Allow_page_locks= on) on [Funscheme]([Employeeno])COMMIT TRANSACTION
Execute the above SQL statement
Where the statement on [Funscheme] ([Employeeno]) is key, indicating that the table employee relies on the partition framework Funscheme to partition, the partition is listed as Employeeno
The partition framework relies on partition functions, that is, partitioned tables rely on partition framework, and partition framework relies on partition function
View Table Partitioning Results
SQL Server creates table partitions