peterausger (8/29/2014)
this is what i tried and not getting the expected op;WITH SInfo AS
(
SELECTsId
,scode
,ParentId
,sName
,CONVERT(nvarchar(800), scode) AS Hierarchy
FROMtest
WHEREParentId=0
UNIONALL
SELECTTH.sId
,TH.scode
,TH.ParentId
,TH.sName
,CONVERT(nvarchar(800), (SInfo.Hierarchy +'\' + CONVERT(nvarchar(800), TH.scode)))
FROMtest TH
INNER JOINSInfoONSInfo.sId = TH.ParentId
)
Select * from SInfo
thanks
peter
Peter,
Post the data and the table as recommended in the first link under "helpful" links in my signature line below and I'm sure that someone will be able to answer your question in two shakes.
--Jeff Moden
Change is inevitable... Change for the better is not.