SQL Server Admin
T-SQL Articles

August 25, 2009

How to Partition Tables of the AdventureWorks Database




A SQLServerCurry viewer contacted me to find out if there was an easy way to create partition tables on the AdventureWorks database. He wanted to study it for educational purposes.

For all those who are looking out for an existing partition script to partition tables of the AdventureWorks database, follow these steps:

Go to http://www.codeplex.com/MSFTScrptProdSamples and download the ‘PartitionScript’ of the SQL Server database version you have installed. I have SQL Server 2008 and I have downloaded the script from here (SQL2008.Data_Engine_Admin_Script.Samples.x86.msi)

Double click and install the .msi. Once the installation is over, look out for PartitionAW.sql in “C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Administration\Partitioning\Scripts” . This script partitions the AdventureWorks tables -- TransactionHistory and TransactionHistoryArchive.

As given in the MSDN documentation:

TheTransactionHistory table contains sales records for the current year. This table is used primarily for inserting new records and updating them as required. The TransactionHistoryArchive table contains sales records older than the current year. This table is used primarily for SELECT queries and as a staging table for moving data into a data warehouse. For more information about the partitioning design of these tables, see Planning Guidelines for Partitioned Tables and Indexes.

After running the query, the output is as shown below:

image


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter



 
  Feedback:

comments

0 Responses to "How to Partition Tables of the AdventureWorks Database"
 

Copyright © 2009-2011 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions