Databases Reference
In-Depth Information
If you have performed the previous recipe, Partitioning a table with
RANGE LEFT , the given script will also return the details, as shown in
following output screenshot, for the partition function and its range values,
as in the previous recipe.
7.
The preceding query should give you a result similar to the one shown in the
following screenshot:
8.
Now, let us create our table tbl_SampleRecords on the partition scheme ps_
OneMillion_RightRange , that we defined, and insert 5 million sample rows:
USE Sample_DB
GO
--Create Sample Table
IF OBJECT_ID('tbl_SampleRecords') IS NOT NULL
DROP TABLE tbl_SampleRecords
CREATE TABLE tbl_SampleRecords
(
ID INT
,SomeData sysname
,CONSTRAINT pk_tbl_SampleRecords_id PRIMARY KEY CLUSTERED(ID)
) ON ps_OneMillion_RightRange (ID)
GO
--Insertinng Sample Records
INSERT INTO tbl_SampleRecords
SELECT TOP 5000000
ID = ROW_NUMBER() OVER(ORDER BY C1.name)
,SomeData = C1.name
FROM sys.columns AS C1
CROSS JOIN sys.columns AS C2
CROSS JOIN sys.columns AS C3
GO
 
Search WWH ::




Custom Search