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.
Author |
Topic |
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-11 : 07:11:14
|
INSERT INTO tblSELECT Id ,LEVELFROM viwWHERE Active = 'Y' connect BY prior viw.Id = viw.sId startWITH viw.sId = @p_Idhow to write this in sql server |
|
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-11 : 07:55:26
|
SELECT PersonId ,LEVELFROM Custom.viwSSAppsEmpMasterExtended vemWHERE IsEmployeeActive = 'Y' connect BY prior vem.PersonId = vem.supervisor_personid startWITH vem.supervisor_personid = @p_PersonIdWITH 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 ,LEVELFROM nWHERE IsEmployeeActive = 'Y'this conversion is ok..... please tell me |
|
|
|
|
|