I am working with an employee database where one of the fields is the hierarchy which shows the manager ID's of those they report to, their directs report to etc.
The structure for this column is as follows:
123|456|789|135|246|790
The employees manager would be 790, their manager 246 etc, all the way up the chain.
I am trying to find out a way to search for a record where X Manager
is in an employees hierarchy.
For example: SELECT FROM employees WHERE '135' IN HierachyColumn
I am unable to use XML due to this being on a linked server which doesn't allow for xml in distributed queries. I say this because I would have wrapped each value in XML and then used .exist
to check its presence.
The data it self that contains this string is within a VIEW
so I can manipulate it a little bit based on suggestions but I am drawing a blank on a good approach.
Are there any other options for searching based on this string?