Hi skhs,
I have already created an automation with connector to populate an attribute in a dataclass with the full path of a location (that works also with cost center and department), used then as a resourcekey to mapping asset to location during file imports. Here is (in comment the check of the dataclass/attribute populated) :
SELECT Guid, Path
FROM dbo.fnAssetHierarchyTreeExcludeChildren('834BC951-D70F-48F4-9E8E-D7E32C68788D', NULL, 0x0, 0x0, 1)
AS h
--LEFT JOIN Inv_Location_Hierarchy dch ON dch._ResourceGuid=h.Guid
--WHERE h.Path<>ISNULL(dch.[Location Hierarchy],'')
ORDER BY Sort