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)
 Tree structure again but this time with character identifiers

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-16 : 13:39:12
Demir writes "Hi,

I am building a small tree structure (which will have a depth of 10 steps max). I am using the common category-parent system. But that was giving me some problems when I tried to do a, "Search under this category" thing. I had to find every sub level and then execute a search in that, and the sublevels of it. So I decided to use character string as category identifiers.

My Root Category is AA
My First Sub level is AAAA
The second sub level is AAAB
the sub level of the first sub is AAAAAA
Guess you got the idea.

In each level I have at least (20 letters and 10 numbers) 30*30=900 possible entries.

This system allows me to do searches under a category, plus it is very easy to build a "Yahoo Style Navigation".

When I want to do a search under the category AAAB all I have to say is say " where Category like 'AAAB%'" (and it works)

When I have to build a navigation bar, I take the categoryID, parse it in 2x (like AA, AAAB,etc) and query these in an or statement with " order by len(Category)".

So you might start wondering about the question. Here they come:

1 - Can this system cause any problems?
2 - If not what kind of indexing and other things should I use to maximize the performance.


Thanks A lot
Demir"
   

- Advertisement -