Main feature of partitioning is splitting single object into multiple relatively independent database objects. Partitioning allows:
- switch partitions from one table to another immediately, because it becomes a meta data operation, rather than physical copy.
- lock single partition instead of the whole table, thus giving several processes simultaneous independent access to each partition.
- spread a single table over multiple db files, storing each partition in its own file
- compress data and change some other properties for each partition individually.
It cannot be done by any other means.
So I think you are looking to a way to assign an ID to each combination of some key, which consists of multiple columns. There is a number of ways to do it, depending on the result you want to achieve:
- Create an index on several columns. It may be clustered, it may be on primary key columns. It will aid searches and get you data sorted (in case of clustered index).
- Create separate table with all your primary key columns and assign each combination a unique key (eg using
IDENTITY
property). Insert this key to your main table to use as "partition id". Insert values automatically using a trigger or a join.
Please note, that SQL Server can use only one column for partitioning.