You are here:Home » tsql » Create a partition table

Create a partition table

--------------------------------------------
-- Script to create a partition table
--------------------------------------------


--Create partition function
CREATE PARTITION FUNCTION myRangePF1 (int)
AS RANGE LEFT FOR VALUES (1, 100, 1000) ;
GO

--Create partition scheme
CREATE PARTITION SCHEME myRangePS1
AS PARTITION myRangePF1
TO (test1fg, test2fg, test3fg, test4fg) ;
GO

--Create partion table
CREATE TABLE PartitionTable (col1 int, col2 char(10))
ON myRangePS1 (col1) ;
GO