Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL server - partitioning - ClientWise

Author  Topic 

xpandre
Posting Yak Master

212 Posts

Posted - 2014-01-23 : 21:58:44
Hi,

I need to setup partitioning in one of my table and that has to be clientwise.

For eg :
I have 3 clients A (1),B(2) and C(3)
CREATE PARTITION FUNCTION PartitionFunction_AllClients (INT) AS RANGE LEFT FOR VALUES (1,2,3)
CREATE PARTITION SCHEME AllClientPartitionScheme AS PARTITION PartitionFunction_AllClients
TO (A,B,C,[primary]) --where A, B and C are 3 different file Groups I have created for each client.

create clustered index PK_table on table1(id) on AllClientPartitionScheme(client_id)

Now the question is :
Say tomorrow a new client comes in (say D(4)), how easy would it to incorporate that into the existing partition system..
Mean..how easy would it be for me to update the partition function to include clientid = 4 and scheme to include new group (D)?

Is there any other way to take care of client wise data partioning in SQL SERVER?

Thanks
Sam

xpandre
Posting Yak Master

212 Posts

Posted - 2014-01-24 : 00:52:28
Just an update:
Using below, I could add N no of clients..

ALTER PARTITION SCHEME AllClientPartitionScheme
NEXT USED [D]; --d is new file group created for clientid 4

ALTER PARTITION FUNCTION PartitionFunction_AllClients () SPLIT RANGE (4);
-------


ALTER PARTITION SCHEME AllClientPartitionScheme
NEXT USED [E]; --E is new file group created for clientid 5

ALTER PARTITION FUNCTION PartitionFunction_AllClients () SPLIT RANGE (5);
Go to Top of Page
   

- Advertisement -