我的 SQL Server 表中有一个包含文件路径的列(包含文件夹和子文件夹)
例如:
/Hidden Reporting/Validation Report
/Top Reporting/Inner/TopTools Report
我目前有一个查询,它返回这些路径的所有主文件夹:
Select Distinct
LEFT((substring(Path, 2, (LEN(Path) - 1))), CHARINDEX('/', (substring(Path, 2,(LEN(Path) - 1)))) - 1) AS Folder
FROM dbo.Catalogs
Where Type=2
结果:
Hidden Reporting
Top Reporting
但我也需要获取子文件夹。
例如:
Hidden Reporting
Top Reporting
Inner
如何在 SQL Server 2008 中执行此操作?