O'Reilly logo

Microsoft SQL Server 2014 Unleashed by Paul Bertucci, Alex T. Silverstein, Chris Gallelli, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required