This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Partition Function Example
This example assumes you have an Orders table that contains a Freight field. It creates a select procedure that counts the number of orders for which freight cost falls into each of several ranges. The
Partition function is used first to establish these ranges, then the SQL Count function counts the number of orders in each range. In this example, the arguments to the
Partition function are
start = 0,
stop = 500,
interval = 50. The first range would therefore be 0:49, and so on up to 500.
SELECT DISTINCTROW Partition
([freight],0, 500, 50) AS Range,
Count(Orders.Freight) AS Count
FROM Orders
GROUP BY Partition
([freight],0,500,50);