Since you asked...

>> How do you get all the parent categories for a given subcategory?

SELECT  *
FROM  tblCategories
WHERE  treepath = Left(@thisTreePath, Len(treepath))
AND  LEN(treepath) < Len(@thisTreePath)

>> Moving a category with subcategories must be a bitch too...

-- error check to not place category into subcategory
IF @oldTP = Left(@newTP, Len(@oldTP)
BEGIN
 THEN RAISERROR ('Illegal category move attempted to self or child node of
self', 16, 1)
 RETURN
END

UPDATE  tblCategories
SET  treePath = @newTP + substring(treePath, Len(@oldTP) + 1,
Len(treePath) - Len(@oldTP))
WHERE Left(treePath, Len(@oldTP)) = @oldTP

I didn't test these, but they should be pretty close.

>From what I know of NTM, I'm sure it is more efficient, but for all the
people that use the EmployeeID/BossEmployeeID type table, this MAY offer a
better solution than what they would otherwise be doing that is also easier
to understand than NTM.  However, I would guess that there's more support
available for NTM.


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to