Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Hierarchy Structure to SQL View

$
0
0

This may seem like a strange Question. I have a Hierarchy Table setup

CREATE TABLE [dbo].[tblHierarchy](
 [pkiID] [int] IDENTITY(1,1) NOT NULL,
 [fkiParentID] [int] NOT NULL,
 [intOrder] [int] NOT NULL,
 [vchDescription] [varchar](256) NULL,
 [boolLeaf] [bit] NULL,
 [vchPL] [varchar](50) NULL,
 CONSTRAINT [PK_tblHierarchy] PRIMARY KEY CLUSTERED
(
 [pkiID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

Pretty Standard Stuff....

Heres the kicker - I want to return the structure in a view (for reporting purposes)

EG

[Parent]      [blank cell]     [blank cell]    [blank cell]
[blank cell]  [child]            [blank cell]    [blank cell]
[blank cell]  [blank cell]     [child]           [blank cell]
[blank cell]  [blank cell]     [child]           [blank cell]
[blank cell]  [blank cell]     [blank cell]    [child]
[blank cell]  [blank cell]     [blank cell]    [child]
[blank cell]  [blank cell]     [child]           [blank cell]
[Parent]      [blank cell]     [blank cell]    [blank cell]

Something to that effect. The depth of the Hierarchy is undefined


your local friendly neighbourhood hobo


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>