Hi guysA system I'm developing has a large reliance on a database. I've been struggling with a few issues, so I thought I'd run it pass the resident DB geniuses here.In the database is a table called Sections, made up of the following structureSectionID int (primary identity)ParentSectionID intSectionName varchar(50)
The idea is there is a parent section (the root level section) then every session under this has a parent section (the section one node above it)So really, just how a file system structure works on computers.Here is the data held in the tableSectionID ParentSectionID SectionName1 0 Main menu2 1 Newsroom3 2 Main stories4 2 Current stories5 1 Crimestoppers6 5 Wanted people7 5 Stolen property
Now what I need to do is create a stored procedure, that will allow me to pass in the path of a section, which will then return to me the SectionID of the section path I've passed in.For exampleexec sppb_GetSectionFromPath '/Main menu/Newsroom/Current stories'
This would return4
Please don't comment on the speed and nature of this system, as it's not a production system but rather a specialist technical demo for something far greater.Any help anybody could provide on how to do this would be very gratefully recieved, thank you.