How to define a hierarchical matrix?

Michael MacGregor 86 Reputation points
2021-04-14T16:57:04.127+00:00

So we're looking at an interesting challenge. First of all we wish to create a hierarchy which can be handled using the hierarchyid datatype such that for corporate clients we can define the various levels, e.g. Enterprise (global), National, Provincial (or State), Regional, Store. The hierarchy levels will be different for different companies, could be more, could be less, either way they can all be defined in a single table.

Now we have an added wrinkle. We have stores that are part of a client hierarchy that are also associated with another client, the company that owns the malls where the stores are located. For most business requirements the hierarchy we use is the main one, but for certain reporting purposes we'd also like to identify the fact that the store is in one of the malls owned by the other client.

So is there a way to use hierarchyid to define a matrix instead of a tree? If not, is there another way to do this?

Regards,

Michael MacGregor
Database Architect

Developer technologies Transact-SQL
SQL Server Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.