Davide Mauri Blog

Experiences with SQL Server

Sql Server 2005 Partition Switch Automation Script

As you should have read in the fantastic Kimberly WhitePaper, partioning gives you an incredible opportunity to load data into your table minimizing locking and having the best performace you can imagine.

The only "drawback" is that the SQL code you need to write and the work you need to do to maintain a partitioned solution (in particular if you have to implement a sliding window scenario) in quite a lot, with only few changes (but essential) every time.

No problem anyway! Using some data from sys tables and the new sqlcmd command everything can be automated!

Here you can find three articles (and scripts) to help you in different scenario:

1 - The basics

2 - Updating existing data

3 - Adding new data while removing old one (Sliding Windows) (work in progress...)

Happy partitioning!

Legacy Comments

re: Partition Switch Automation Script
Plase post the script