I have a large table that I would like to partition. The field I want to partition against is a string that contains a coded value, but appears as an integer stored as a string. The "number" is made up of 4 digits. The first two are what I want to partition against. For instance, the field value of "1298", would need to partition using the value 12. I thought this would be a great use for a hash partition with a custom hash function.
For some reference:
Queries are frequently made against this column in the form of ... WHERE TheField = '0123'
or ... WHERE TheField IN ('0123', '0145', '0232')
It would be impractical to manually each value to go into each partition, so I thought using a custom hash function would be a practical solution.
Actual Question: How do I make this custom hash function and use it to define the partitions?