Quantcast
Channel: Questions in topic: "sql-server-2005"
Viewing all articles
Browse latest Browse all 415

How to create a parent child hierarchy from full path (MSSQL)

$
0
0
I have a field/column in at table stored in MSSQL 2008 containing full paths of some documents. I need the paths transformed into a parent child hierarchy like shown below. I need this structure because it is required of the third party software I am using it for. How is this done most elegant? From: root/Dir1/Dir11/Dir3/Docname1.txt root/Dir1/Dir12/Dir3/Docname2.txt root/Dir1/Dir11/Docname3.txt root/Dir1/Dir11/Dir31/Docname4.txt To: [Value] [Parent] Docname1.txt root/Dir1/Dir11/Dir3 root/Dir1/Dir11/Dir3 root/Dir1/Dir11 root/Dir1/Dir11 root/Dir1 root/Dir1 root Docname2.txt root/Dir1/Dir12/Dir3 root/Dir1/Dir12/Dir3 root/Dir1/Dir12 root/Dir1/Dir12 root/Dir1 root/Dir1 root Docname3.txt root/Dir1/Dir11 root/Dir1/Dir11 root/Dir1 root/Dir1 root Docname4.txt root/Dir1/Dir11/Dir31 root/Dir1/Dir11/Dir31 root/Dir1/Dir11 root/Dir1/Dir11 root/Dir1 root/Dir1 root

Viewing all articles
Browse latest Browse all 415

Trending Articles