Viewing 6 posts - 16 through 21 (of 21 total)
---- create table
create table test(sid bigint, scode nvarchar(50), parentid bigint, sname nvarchar(50))
---- insert records
insert into test values (1, '11', 0, 'a')
insert into test values (2, '111', 1, 'b')
insert into...
August 29, 2014 at 8:57 am
Kindly find attached the table and the op required..
Hope this info is good enough...
Thanks
Peter
August 29, 2014 at 6:35 am
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...
August 29, 2014 at 4:49 am
Hello there,
I tried different options but not getting exactly what i am looking for..
Kindly refer the attachment for the expected op
Thanks
Peter
August 29, 2014 at 3:32 am
Viewing 6 posts - 16 through 21 (of 21 total)