izznoland, if you want to get the complete hierarchy from a CI you need to recursively read the busmgt table. You can do it from client side but it's way faster DB side
Here's how to do it :
USE [mdb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[getUpperHierarchyFromRoot]
@rootCIUUID binary(16)
AS
BEGIN
SET NOCOUNT ON;
With ciHierarchy(childUUID,relType,parentUUID)
as
(
Select BMHIER.hier_child, BMHIER.ci_rel_type, BMHIER.hier_parent
from mdb.dbo.busmgt BMHIER
where BMHIER.hier_child = @rootCIUUID
UNION ALL
Select BMHIER.hier_child, BMHIER.ci_rel_type, BMHIER.hier_parent
from mdb.dbo.busmgt BMHIER
inner join ciHierarchy BMHIERTEMP
on BMHIERTEMP.parentUUID=BMHIER.hier_child
)
select * from ciHierarchy
END
If you want both side relations, you can create two CTE, and looking for relation having @rootCIUUID as the parent, and joining on the child instead of the parent, and union them both together with a select.
You may want to join on "mdb.dbo.ca_owned_resource" to get informations for every CI, and on "mdb.dbo.ci_rel_type" to get relation "description".
Hope this helps.