|
OriginalGriff wrote: which tends to look like a stroke victim
And that explains why it is a hospital center... (according Wikipedia at least)
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
That spelling makes a lot of sense once you see how it's pronounced
|
|
|
|
|
|
So does Arsenic!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Yes, but I've eaten seaweed before and enjoyed it.
|
|
|
|
|
Finding all child / parent rows is easy. It's when you need to find all descendant / ancestor rows that you might need to turn to hierarchyid[^] for help.
Tutorial: Using the hierarchyid Data Type[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It's all ancestors and descendants I needed - and I managed it quite well: Never really got my head round recursive CTE's though!
ALTER PROCEDURE [dbo].[spGetChildPages]
@PageID UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Empty UNIQUEIDENTIFIER;
SET @Empty = dbo.fGetEmptyGuid();
WITH Children AS(
SELECT * FROM Pages WHERE ID = @PageID AND ID != @Empty
UNION ALL
SELECT p.* FROM Pages p
INNER JOIN Children c ON p.ParentID = c.ID
)
SELECT * FROM Children WHERE ID != @PageID;
END
ALTER PROCEDURE [dbo].[spGetParentPages]
@PageID UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Empty UNIQUEIDENTIFIER;
SET @Empty = dbo.fGetEmptyGuid();
WITH Parents AS (
SELECT *, 1 AS Level FROM Pages WHERE ID = @PageID AND ParentID != @Empty
UNION ALL
SELECT p.*, Level+1 AS Level FROM Pages p
INNER JOIN Parents pp ON p.Id = pp.ParentId AND pp.ID != @Empty
)
SELECT ID, PageName, ParentID, SetID
FROM Parents
WHERE ID != @Empty AND ID != @PageID
ORDER BY level DESC
END I needed them for a hierarchical set of pages with a delete and restore feature.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Looks like you managed quite fine. Wait until you need to find the common ancestors of several nodes (I've already done it[^])
One thing I'm interested in, why are you using an EmptyGuid instead of just using NULL?
Oh, and BTW, I'm with Jeff Moden on HierarchyID, I don't use them.
|
|
|
|
|
It makes another part of the software easier, but I don't like it.
I'm mulling it over and may change it back to null - not a problem yet, I'm doing the DL design first this time.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Jörgen Andersson wrote: I don't use them While I dislike the HID I love the concept and use it extensively. However I mine is a NodeKey and is a varchar field.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't have a problem with the concept, I have also used it myself, I just find the implementation a bit lacking.
I prefer a combo of nested sets and adjacency lists instead of path enumeration.
|
|
|
|
|
OriginalGriff wrote: a morning spent working out SQL SP's to "find all Child" and "find all Parent" rows
That's got to be at least a zillion calories eh?
New version: WinHeist Version 2.2.2 Beta I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!
|
|
|
|
|
Quite a few brain cells committed suicide, anyway.
SQL syntax isn't the most obvious...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Friends don't let friends do SQL!
SQL leads to CRS
New version: WinHeist Version 2.2.2 Beta I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!
|
|
|
|
|
Sometimes, you gotta do it in the server.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
|
Don't eat yellow snow.
Rules for playing Javascript frameworks.
1. You can't win.
2. You can't break even.
3. You can't get out of the game.
|
|
|
|
|
|
Indeed, Happy Birthday to Mrs. Nishant, and, I hope she's getting combat pay for putting up with Mr. Nishant !
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|
|
I hope the blighter has finally learned to make an omlette. IIRC, he's been promising to cook her a nice breakfast for several years.
/ravi
|
|
|
|
|
LOL
|
|
|
|
|
Hey!
|
|
|
|
|
Thanks Ravi! Very thoughtful of you!
|
|
|
|
|
I use my Wii with Component Video and am older Toshiba TV, and the TV won't display anything unless I power the Wii and the TV on at the EXACT same instant. This appears to be a common problem with older Toshiba TVs and component video, from the information I gathered from various forums.
Seriously, did they not test component input back then? How could they miss such a major flaw?
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|