SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Automated Script to Partition Tables

By Aditya Kota,


I work in a very big environment and all of our Fact Tables are partitioned on a day-day basis.

The date partition is from our dimension process. Hence, the fact tables are partitioned on the date dimension.


The below script gives you the ease of generating an automatic script which prints the filegroup, file for the partition and also prints the Alter Partiton scheme to use the filegroup and also the splits the partiton function.


Our SAN is carved with smaller chunks for optimal performance and i follow a round-robin algorithm while partitoning. So, that is the reason for the drive names are named with Mount points and practically each one used for a specific partition.


This gives an ease for extending partitions on a day-day basis.


I hope this script will help a lot of folks out there...working in a warehouse!!!

Total article views: 2329 | Views in the last 30 days: 9
Related Articles




Partition Info using VB Script

SSIS Package using VB Script task to retreive partition information


Table Partitioning in SQL Server 2005

Sample script for Table Partition