Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Equivalent SQL Sever stmt

Author  Topic 

venkatkrishna
Starting Member

12 Posts

Posted - 2007-05-21 : 02:24:15
Hello,

The following stmt written in Oracle contains the some predefiend functions like sys_connect_by_path,start with,connect by prior. can any help me to get the same sql server stmt to get the same result.

SELECT ccd, tcd, loc_id, t.rcd tsr,
SUBSTR
(sys_connect_by_path (t.ttid,
','),
2,
INSTR
(sys_connect_by_path
(t.ttid,
','
),
',',
1,
2
)
- 2
) rm_ttid,
CASE
WHEN LEVEL = 2
THEN ttid
ELSE SUBSTR
(sys_connect_by_path
(t.ttid,
','
),
INSTR
(sys_connect_by_path
(t.ttid,
','
),
',',
1,
2
)
+ 1,
INSTR
(sys_connect_by_path
(t.ttid,
','
),
',',
1,
3
)
- INSTR
(sys_connect_by_path
(t.ttid,
','
),
',',
1,
2
)
- 1
)
END dm_ttid
FROM v_da_ff_territory t
WHERE ccd = 'AM'
AND t.active_fg = 'Y'
AND t.territory_type_cd = 'FF'
--and t.rcd <> 'TSR'
START WITH rcd = 'R'
CONNECT BY PRIOR ttid = t.rpt_lvl1_terr

Regards,
Krishna

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-21 : 02:32:29
Duplicate: [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=83854[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -