|
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???
|
|
|
|
|
At least you have a workaround. I'm sure the official response is "upgrade to a newer TV set". In which case I would, except that Toshiba would be excluded from the list of contenders. And I'd make sure they know.
|
|
|
|
|
The TV was my Uncle's, but he gave it to me when he got a newer one. It works perfectly fine with all other inputs, and I don't use my Wii all that often anymore. I mostly use it for some Gamecube games I still like to play, like 'Paper Mario: The Thousand Year Door', 'Mario Kart: Double Dash!', and 'The Legend of Zelda: Four Swords Adventures'.
We also have a 50" Sanyo HDTV in our TV room, and that thing is AWESOME! Amazing picture and sound quality, and all the inputs work perfectly. Although I guess most TVs are better in that regard. Wasn't all that expensive, either.
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???
|
|
|
|
|
My guess, that TV works fine with the component video test source that Toshiba used.
I had a similar you-first deadlock with getting an old laptop to talk to a monitor back in the day.
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
I try to find a good reason to buy an external SSD drive.
diligent hands rule....
|
|
|
|
|
Southmountain wrote: a good reason to buy an external SSD drive
Price. I picked up two 480's last week for $150 (US) each. I'm waiting for a hdd caddy/cable for the 2nd drive bay in my laptop. Once I have that, I should be able to clone the system drive and recovery partitions to a new SSD. The other one ssd is on standby for my home/office server when I get around to it. I could actually get away with only the single 480GB SSD but for now, I'll keep the old 1TB spinning disk in for extra storage.
I'll admit I was on a spending spree last week. I also bought a pair of 27'' displays, also for $150 each. To top it all off, I also got a GoPro Hero5 Session. It was a late Christmas to myself!
Edit: Back to the point, I don't think SSDs are very popular as external drives since the usual purpose of external drives are to extend capacity or to keep backups. I think that's likely to change as the GB/$ ratio gets closer to spinners. I do wonder though if there wouldn't be a bottleneck at the external connection.
Also, the extra hdd kit for the laptop has arrived and I am starting the disassembly...about 15 screws to get the entire lower plate off. Here we go!
"Go forth into the source" - Neal Morse
modified 11-Feb-17 19:18pm.
|
|
|
|
|
I've occasionally run naked SSD's externally using a USB->SATA adapter cable (the one with 2 USB connectors for more power), even using both USB tended to be flaky so firstly I would suggest if jumping in today definitely go externally powered.
Even then using USB 3 couldn't get full speed so no real speed advantage over a spinner, particularly if you are looking for backup/archiving purposes. With external spinners starting to appear in the bargain bins also need the price to drop even more.
Sure, at the current rate spinners will probably be obsolete in 5 years, but we're not there yet. I would wait till better USB is settled and mainstream - early adopters too often burned on both price and compatibility.
Sin tack ear lol
Pressing the any key may be continuate
|
|
|
|