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
 General SQL Server Forums
 New to SQL Server Programming
 migration from oracle

Author  Topic 

TajKazi
Posting Yak Master

101 Posts

Posted - 2014-11-11 : 07:11:14
INSERT INTO tbl
SELECT Id
,LEVEL
FROM viw
WHERE Active = 'Y' connect BY prior viw.Id = viw.sId start
WITH viw.sId = @p_Id


how to write this in sql server

TajKazi
Posting Yak Master

101 Posts

Posted - 2014-11-11 : 07:55:26
SELECT PersonId
,LEVEL
FROM Custom.viwSSAppsEmpMasterExtended vem
WHERE IsEmployeeActive = 'Y' connect BY prior vem.PersonId = vem.supervisor_personid start
WITH vem.supervisor_personid = @p_PersonId



WITH n(PersonId, LEVEL) AS (
SELECT PersonId
,LEVEL
FROM Custom.viwSSAppsEmpMasterExtended vem
WHERE vem.supervisor_personid = @p_PersonId

UNION ALL

SELECT np.personid
,np.LEVEL
,IsEmployeeActive
FROM Custom.viwSSAppsEmpMasterExtended AS np
INNER JOIN n ON n.PersonId = np.supervisor_personid
)

SELECT PersonId
,LEVEL
FROM n
WHERE IsEmployeeActive = 'Y'



this conversion is ok..... please tell me
Go to Top of Page
   

- Advertisement -