Creating a Partition Function

A partition function identifies values within a table that will be compared to the column on which you partition the table. As mentioned previously, it is important that you know the distribution of the data and the specific range of values in the partitioning column before you create the partition function. The following query provides an example of determining the distribution of data values in the SalesOrderDetail table by year:

--Select the distinct yearly valuesSELECT year(modifiedDate) as 'year', count(*) 'rows' FROM [AdventureWorks2012].[Sales].[SalesOrderDetail] GROUP BY year(modifiedDate) ORDER BY 1go       year        rows----------- -----------       2005        5151       2006       19353 ...

Get Microsoft SQL Server 2014 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.