I have been trying to figure out how do determine the path to a given folder with a SQL query for a long time. Finally I had a project where I really need this ability so I searched online for something similar.
Eventually I found this: Dump list of full paths of parent/child type records in SQL Server 2008 R2
Which I changed to look like this:
USE PWDemoMSSQLGOWITH folder_paths (o_projectno, folder_path)AS(-- Anchor…