Sql Server 2017 Hash partition

nizar abdelkebir 21 Reputation points
2021-01-29T15:03:01.183+00:00

Hello, I have a question please.

Using Sql server 2017 version, I try to create partitions in a table, so I would know, can I use Hash partition?

For exemple, this is a function partition use Int :

create partition function PartitionFunctionByInt (int) as range LEFT for values (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)

How can I adopt this with Hash please?

Thank you for helping.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,736 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,552 questions
0 comments No comments
{count} votes

Accepted answer
  1. tibor_karaszi@hotmail.com 4,301 Reputation points
    2021-01-29T15:14:58.813+00:00

    There's only range partitioning in SQL Server.

    When SQL Server 2005 was in beta, we had hash partitioning, but that didn't make it to the released product. And it wasn't introduced in later versions either.


1 additional answer

Sort by: Most helpful
  1. Erland Sommarskog 101K Reputation points MVP
    2021-01-29T23:02:19.083+00:00

    You can still roll your own hash partitioning. That is, your partition key could be a "hash" of some data that places data more or less randomly in any of these 36 buckets. But you would have to have quite a specialised use case for this to make sense.

    1 person found this answer helpful.
    0 comments No comments