Avatar of mssql_v2005
mssql_v2005

asked on 

Partitioning by GUID+ SQL Server 2012

Hi ALL:

I have a table which has a Uniqueidentifier Column. I would like to Partition this table using Partition function and schema in SQL Server 2012 by this Uniqueidentifier Column. I would like to partition by first 2 bytes.

I have created 16 partitions with RANGE RIGHT as below. Is my calculation analysis on Partition function and schema & below script is correct??
CREATE PARTITION FUNCTION [pf_GUIDRangePartition](uniqueidentifier) AS RANGE RIGHT  
FOR VALUES  
(
'00000000-0000-0000-0000-000000000000',
'00000000-0000-0000-0000-100000000000',
'00000000-0000-0000-0000-200000000000',
'00000000-0000-0000-0000-300000000000',
'00000000-0000-0000-0000-400000000000',
'00000000-0000-0000-0000-500000000000',
'00000000-0000-0000-0000-600000000000',
'00000000-0000-0000-0000-700000000000',
'00000000-0000-0000-0000-800000000000',
'00000000-0000-0000-0000-900000000000',
'00000000-0000-0000-0000-A00000000000',
'00000000-0000-0000-0000-B00000000000',
'00000000-0000-0000-0000-C00000000000',
'00000000-0000-0000-0000-D00000000000',
'00000000-0000-0000-0000-E00000000000',
'00000000-0000-0000-0000-F00000000000',
'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF'
)

CREATE PARTITION SCHEME [ps_GUIDRangePartition]
AS
PARTITION [pf_GUIDRangePartition] TO
(FG_1,FG_2,FG_3,FG_4,FG_6,FG_7,FG_8,FG_9,FG_10,FG_11,FG_12,FG_13,FG_14,FG_15,FG_16,[PRIMARY])
GO

Open in new window

Microsoft SQL ServerMicrosoft SQL Server 2008SQL

Avatar of undefined
Last Comment
Vitor Montalvão

8/22/2022 - Mon