Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Webpage -> DB lookup problem

Author  Topic 

MaverickUK
Yak Posting Veteran

89 Posts

Posted - 2004-10-07 : 09:20:27
Hi guys

A 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 structure

SectionID int (primary identity)
ParentSectionID int
SectionName 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 table

SectionID ParentSectionID SectionName
1 0 Main menu
2 1 Newsroom
3 2 Main stories
4 2 Current stories
5 1 Crimestoppers
6 5 Wanted people
7 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 example


exec sppb_GetSectionFromPath '/Main menu/Newsroom/Current stories'

This would return

4


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.

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-10-07 : 09:32:24
http://www.sqlteam.com/item.asp?ItemID=8866
Go to Top of Page

MaverickUK
Yak Posting Veteran

89 Posts

Posted - 2004-10-07 : 10:10:29
This looks good so far :) Cheers

(I'm sure I'll be back if it doesn't work out!)
Go to Top of Page
   

- Advertisement -