{"id":259,"date":"2013-01-22T16:07:02","date_gmt":"2013-01-22T16:07:02","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=259"},"modified":"2014-03-06T16:15:25","modified_gmt":"2014-03-06T16:15:25","slug":"sql-server-partition-wizard","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/sql-server-partition-wizard\/","title":{"rendered":"SQL Server Partition Wizard"},"content":{"rendered":"<p>SQL Server Partitioning can be a bit confusing and can lead some companies in a different direction as far as archiving data. Writing the T-SQL code to create partition functions, partition schemes, and then altering the table to use the partition can be overwhelming for some DBA&#8217;s. SQL Server 2008 introduced a table partitioning wizard in SQL Server Management Studio that helps make this task easier. In this post, I&#8217;ll show you how to use this wizard.\u00a0 Let&#8217;s jump in.<\/p>\n<p>Based on my experience, it seems as if SQL Server table partitioning is not commonly used and I&#8217;m not sure if it&#8217;s because of the complexity and management of partitions or if companies simply don&#8217;t have the knowledge of partitioning data.\u00a0 This tip will focus on the SQL Server Partitioning wizard as opposed to the ins and outs of partitioning.<\/p>\n<p>To start the wizard, right click on the table you want to partition in SQL Server Management Studio and select Storage, Create Partition. In this example, I&#8217;m using AdventureWorks2012.Production.TransactionHistory.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-260\" alt=\"SQL Freelancer SQL Server Partition Wizard\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard.png\" width=\"730\" height=\"336\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard.png 730w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-300x138.png 300w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/a><\/p>\n<p>On the Select a Partitioning Column screen as shown below you will need to select the column that you want to use to partition your table. The most common column used is a date column since most tables are being archived by date. In this example, I&#8217;ll choose TransactionDate so I&#8217;ll partition my table based on the date when the transaction was entered into this table.<\/p>\n<p>Other options include:<\/p>\n<p><strong>Collocate this table to the selected partition table:<\/strong> Displays related data to join with the column being partitioned.<\/p>\n<p><strong>Storage Align Non Unique Indexes and Unique Indexes with an Indexed Partition Column:<\/strong> Aligns all indexes of the table being partitioned with the same partition scheme. If you do not select this option, you may place indexes independently of the columns they point to.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-261\" alt=\"SQL Freelancer SQL Server Partition Wizard\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-1.png\" width=\"603\" height=\"500\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-1.png 603w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-1-300x248.png 300w\" sizes=\"auto, (max-width: 603px) 100vw, 603px\" \/><\/a><br \/>\nThe next screen, Select a Partition Function, is where you will create the partition function. This will create a function that maps the rows of the table or index into partitions based on the values of the TransactionDate column. In this example, I&#8217;ll name the function TransactionHistoryFunction.<br \/>\n<a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-262\" alt=\"SQL Freelancer SQL Server Partition Wizard\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-2.png\" width=\"603\" height=\"500\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-2.png 603w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-2-300x248.png 300w\" sizes=\"auto, (max-width: 603px) 100vw, 603px\" \/><\/a><br \/>\nThe next screen, Select a Partition Scheme, is where you will create the partition scheme. This will create a scheme that maps the partitions of the Production.TransactionHistory table to different filegroups. In this example, I&#8217;ll name the scheme TransactionHistoryScheme.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-263\" alt=\"SQL Freelancer SQL Server Partition Wizard\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-3.png\" width=\"603\" height=\"500\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-3.png 603w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-3-300x248.png 300w\" sizes=\"auto, (max-width: 603px) 100vw, 603px\" \/><\/a><br \/>\nThe next screen, Map Partitions, is where you will map your partitions.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-264\" alt=\"SQL Freelancer SQL Server Partition Wizard\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-4.png\" width=\"603\" height=\"500\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-4.png 603w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2014\/03\/SQL-Server-Partition-Wizard-4-300x248.png 300w\" sizes=\"auto, (max-width: 603px) 100vw, 603px\" \/><\/a><br \/>\n<a href=\"http:\/\/www.mssqltips.com\/sqlservertip\/2856\/sql-server-partition-wizard\/\" target=\"_blank\">Click here to view the rest of this post.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL Server Partitioning can be a bit confusing and can lead some companies in a different direction as far as archiving data. Writing the T-SQL code to create partition functions, partition schemes, and then altering the table to use the partition can be overwhelming for some DBA&#8217;s. SQL Server 2008 introduced a table partitioning wizard [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63],"tags":[64,109,39],"class_list":["post-259","post","type-post","status-publish","format-standard","hentry","category-partitioning","tag-archive","tag-partitioning","tag-ssms"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=259"}],"version-history":[{"count":1,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/259\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/259\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}