|
venkatkrishna
Starting Member
12 Posts |
Posted - 2007-05-30 : 05:35:06
|
| Hello,I could not find the proper solution to convert the stmt to sqlserver 2000.can u help me how to convert the folllwing oracle stmt into sql server2000. here are the keywords used does not support in sqlserver sys_connect_by_path,start with ,connect by prior.It is in urgent basis.select f.area_cd,f.area_desc,f.region_cd,f.region_desc,f.territory_id,f.region_office_city,f.region_office_state,f.territory_city,f.territory_state,f.role_cd,fe.emplid,fe.preferred_name,fe.first_name,fe.last_name,fe.voice_mail,fe.internet_address,am_count,cec_count,am_count + cec_count totalfrom (select t.area_cd,t.area_desc,t.region_cd,t.region_desc,t.territory_id,t.region_office_city,t.region_office_state,t.territory_city,t.territory_state,t.role_cd,count (casewhen h.role_cd = 'AM'then 1end) am_count,count (casewhen h.role_cd = 'CEM' then 1end) cec_countfrom v_da_ff_territory t,(select cluster_cd,team_cd,loc_id,role_cd,substr(sys_connect_by_path (t.territory_id,','),2,instr(sys_connect_by_path(t.territory_id,','),',',1,2)- 2) rm_territory_id,casewhen level = 2then territory_idelse substr(sys_connect_by_path(t.territory_id,','),instr(sys_connect_by_path(t.territory_id,','),',',1,2)+ 1,instr(sys_connect_by_path(t.territory_id,','),',',1,3)- instr(sys_connect_by_path(t.territory_id,','),',',1,2)- 1)end dm_territory_id,casewhen level = 3then territory_idelse substr(sys_connect_by_path(t.territory_id,','),instr(sys_connect_by_path(t.territory_id,','),',',1,3)+ 1,instr(sys_connect_by_path(t.territory_id,','),',',1,4)- instr(sys_connect_by_path(t.territory_id,','),',',1,3)- 1)end cem_territory_idfrom v_da_ff_territory twhere cluster_cd = 'MM'and t.active_fg = 'Y'and t.territory_type_cd = 'FL'--and t.role_cd <> 'TSR'start with role_cd in ('MMRM', 'TM')connect by prior territory_id = t.rpt_lvl1_terr) hwhere t.cluster_cd = h.cluster_cdand t.role_cd != 'RC'and t.territory_id in(rm_territory_id, dm_territory_id, cem_territory_id)group by t.area_cd,t.area_desc,t.region_cd,t.region_desc,t.territory_id,t.region_office_city,t.region_office_state,t.territory_city,t.territory_state,t.role_cd) fleft join(select *from v_da_field_employee fe1where fe1.field_active = 'A') feon f.territory_id = fe.territory_idorder by area_cd, region_cdRegards,Krishna Murthy.K |
|