SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Print Tree


Print Tree

Author
Message
deepforest
deepforest
SSC Eights!
SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)

Group: General Forum Members
Points: 910 Visits: 621
Comments posted to this topic are about the item Print Tree
ta.bu.shi.da.yu
ta.bu.shi.da.yu
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1937 Visits: 494
Wouldn't a recursive CTE do this better?

Random Technical Stuff
deepforest
deepforest
SSC Eights!
SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)

Group: General Forum Members
Points: 910 Visits: 621
I don't know, but I like that it doesn't have any stack limit and it's more clear what's going on.
YSLGuru
YSLGuru
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11389 Visits: 1675
Dumb question but could you provide an example of populating the TREE table? I believe i am following the TREE tables design but it would be nice to see an example of how you'd populate the table.

Thanks

Kindest Regards,

Just say No to Facebook!
deepforest
deepforest
SSC Eights!
SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)SSC Eights! (910 reputation)

Group: General Forum Members
Points: 910 Visits: 621
You know, it's painful to populate the tree, have someone from the 'paper work' department type it in an xsl ;-)

or here's a few inserts for the sample:


insert btree values('00499133-96F8-444A-A938-003E7D5648B6','F32ED73E-2537-439A-8F3F-8EB18260FB4D','holly oak ','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('F5BA6F4A-C62D-4002-A67D-0244F55C4A67','F32ED73E-2537-439A-8F3F-8EB18260FB4D','magnolia','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('D389E450-AE3A-4C6F-A9F8-0A9454D2F667','ACD5A30E-6172-4F4E-BAE9-4AAA202FC244','holly','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('4B2330B8-F00F-4C5D-AD58-0D2FA50CE893','5FE19B8C-0E98-4226-AD64-EE6046232184','redbud','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('7FC456B3-E5F3-49AA-89B3-12D1D1FBCAB3','533B78ED-69A8-40CA-9781-75FBFA29A513','hazelnut ','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('ACE59D55-6D92-4DF0-A690-16D2C4A1EF69','A55F6339-7D37-4425-A23C-3C315CCCA15A','cedar','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('8BBF4010-AC08-4399-8073-1F362FB5F42B','F32ED73E-2537-439A-8F3F-8EB18260FB4D','linden','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('5C308FD7-8E7D-4A8A-AB0F-2A8372650D63','F32ED73E-2537-439A-8F3F-8EB18260FB4D','spruce','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('6AAF05A5-5C6D-43F2-A5F6-386632F2CA1F','F5BA6F4A-C62D-4002-A67D-0244F55C4A67','rhododendron','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('A55F6339-7D37-4425-A23C-3C315CCCA15A','F93D5F65-65C2-479F-BD99-45D379F4A95C','buckey','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('F93D5F65-65C2-479F-BD99-45D379F4A95C','F32ED73E-2537-439A-8F3F-8EB18260FB4D','aspen','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('ACD5A30E-6172-4F4E-BAE9-4AAA202FC244','F32ED73E-2537-439A-8F3F-8EB18260FB4D','fir','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('233F8334-24ED-4683-B25B-4E6ACFC0C558','00499133-96F8-444A-A938-003E7D5648B6','pine','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('79295A77-6F4D-45A5-A344-5DE0428E7F52','ACE59D55-6D92-4DF0-A690-16D2C4A1EF69','chestnut ','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('1E4AEA87-83BF-400B-B7B5-6119252165F1','F5BA6F4A-C62D-4002-A67D-0244F55C4A67','plum','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('5D8798D5-FE19-4B46-BC20-648788A130AB','40470AF5-E9DA-4B8E-9A01-8A59E780EDC6','pecan','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('700FFF9A-2D40-485B-9FB2-6745D3B6F731','D9E1D3CB-8A60-410D-88AD-CB03C8052A6A','oak','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('D35451E8-77DB-4C61-BF42-72771DCD70BE','700FFF9A-2D40-485B-9FB2-6745D3B6F731','maple','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('533B78ED-69A8-40CA-9781-75FBFA29A513','F32ED73E-2537-439A-8F3F-8EB18260FB4D','ginkgo','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('1D129998-8052-4244-8427-892AF212A24C','F32ED73E-2537-439A-8F3F-8EB18260FB4D','ebony','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('40470AF5-E9DA-4B8E-9A01-8A59E780EDC6','F32ED73E-2537-439A-8F3F-8EB18260FB4D','ash','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('F32ED73E-2537-439A-8F3F-8EB18260FB4D','00000000-0000-0000-0000-000000000000','cypress','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('37788BBF-A74C-43C8-9CD5-9051076E8C17','F32ED73E-2537-439A-8F3F-8EB18260FB4D','hemlock','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('307318FC-162F-443D-A31A-9B991398EDFA','F32ED73E-2537-439A-8F3F-8EB18260FB4D','live oak','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('1A6B06AF-48D1-4363-9BDE-9E0B5EDC7CEC','F32ED73E-2537-439A-8F3F-8EB18260FB4D','apricot','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('AC4F7366-4E7B-496E-BF85-A4A4CC426301','40470AF5-E9DA-4B8E-9A01-8A59E780EDC6','birch','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('7F0A73D1-A5E4-4DCE-967F-B5A9C7F424E3','40470AF5-E9DA-4B8E-9A01-8A59E780EDC6','beech','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('201F8C9A-DB8D-4749-98AB-BEEE88CBAF52','ACD5A30E-6172-4F4E-BAE9-4AAA202FC244','juniper','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('03FB8F4C-F8DB-4CCD-9234-C7EE50705467','F32ED73E-2537-439A-8F3F-8EB18260FB4D','cherry','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('D9E1D3CB-8A60-410D-88AD-CB03C8052A6A','5C308FD7-8E7D-4A8A-AB0F-2A8372650D63','southern magnolia','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('C0BE4F66-A1AF-4F39-AC4D-CBBDEDE51B86','7B3B218A-4DF1-483C-B5F0-D30F80FA2E53','palm','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('7B3B218A-4DF1-483C-B5F0-D30F80FA2E53','F32ED73E-2537-439A-8F3F-8EB18260FB4D','apple','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('78818F6F-46C0-4C12-9663-D4903BA42847','40470AF5-E9DA-4B8E-9A01-8A59E780EDC6','willow','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('5FE19B8C-0E98-4226-AD64-EE6046232184','F32ED73E-2537-439A-8F3F-8EB18260FB4D','dogwood','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
insert btree values('AE077991-BA31-4488-AC2C-F4A6050E062D','40470AF5-E9DA-4B8E-9A01-8A59E780EDC6','gum','F32ED73E-2537-439A-8F3F-8EB18260FB4D')
YSLGuru
YSLGuru
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11389 Visits: 1675
Thanks for the sample Deepforest but I was hpoing you'd drop in something a little more flexable like a select from one of the sample MS DBs, something like this

INSERT INTO TREE(col1,col2,col3,,,,)
SELECT A.col1, A.Col2, B.Col2
FROM TABLE A Join TABLE B ON ...



And so on. That way I could see how you are relating the data in the TREE table to a real world (like the PUBS DB) example.

Kindest Regards,

Just say No to Facebook!
Iwas Bornready
Iwas Bornready
SSC-Dedicated
SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)SSC-Dedicated (38K reputation)

Group: General Forum Members
Points: 38886 Visits: 886
Thanks for the script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search