Overblog All blogs Top blogs Tech & Science
Follow this blog Administration + Create my blog
MENU

Design over time...

Welcome to oblivion

Jul 04 2012 Jul 04 2012
Post type Text

Posted Jul 04 2012 by Joe Garrett

Jul 01 2012 Jul 01 2012
Post type Text

Posted Jul 01 2012 by Joe Garrett

Jul 01 2012 Jul 01 2012
Post type Text

Posted Jul 01 2012 by Joe Garrett

Jun 26 2012 Jun 26 2012
Post type Text

Posted Jun 26 2012 by Joe Garrett

Jun 21 2012 Jun 21 2012
Post type Text

Posted Jun 21 2012 by Joe Garrett

Jun 19 2012 Jun 19 2012
Post type Text

Posted Jun 19 2012 by Joe Garrett

Jun 16 2012 Jun 16 2012
Post type Text

SQL Hierarchical Data (Simplified)

Posted Jun 16 2012 by Joe Garrett in SQL StoreProcedure

Create The SQL Table {tblTree}:

  • ID {Unique ID Identity Seed}

  • ParentID {bigint}

  • Name{varchar(50)}

Create Stored Procedure {spGenerateTree}

CREATE PROCEDURE spGenerateTree

@lookupid bigint

AS

BEGIN

WITH CTE(name, id, parentid) AS

(

SELECT name, childid, parentid from tblTree where id=@lookupid

UNION ALL

SELECT tree.name, tree.id, tree.parentid

from tblTree tree

INNER JOIN CTE c ON tree.ID = c.parentid

)

SELECT * FROM CTE

END

Populate tblTree with your Tree Data and voila at execution of the PROC you will have a nested iHierarchal Dataset directly from SQL that you can use in your C# ASP.NET Page.

Jun 16 2012 Jun 16 2012
Post type Text

Posted Jun 16 2012 by Joe Garrett

Jun 16 2012 Jun 16 2012
Post type Text

Posted Jun 16 2012 by Joe Garrett

Jun 10 2012 Jun 10 2012
Post type Text

Posted Jun 10 2012 by Joe Garrett

Next page