Click here to Skip to main content
15,892,839 members
Home / Discussions / Database
   

Database

 
GeneralRe: Get hirarchy query Pin
ScottM118-Aug-10 2:09
ScottM118-Aug-10 2:09 
GeneralRe: Get hirarchy query Pin
ScottM118-Aug-10 2:10
ScottM118-Aug-10 2:10 
GeneralRe: Get hirarchy query Pin
SatyaKeerthi1518-Aug-10 18:52
SatyaKeerthi1518-Aug-10 18:52 
GeneralRe: Get hirarchy query Pin
ScottM118-Aug-10 20:56
ScottM118-Aug-10 20:56 
GeneralRe: Get hirarchy query Pin
SatyaKeerthi1518-Aug-10 21:11
SatyaKeerthi1518-Aug-10 21:11 
GeneralRe: Get hirarchy query Pin
ScottM118-Aug-10 21:17
ScottM118-Aug-10 21:17 
GeneralRe: Get hirarchy query Pin
SatyaKeerthi1518-Aug-10 19:01
SatyaKeerthi1518-Aug-10 19:01 
QuestionGet hirarchy query Pin
SatyaKeerthi1518-Aug-10 19:02
SatyaKeerthi1518-Aug-10 19:02 
This is the sp I have tried. I am getting what I want but in print statement. How to convert it into Table.

ALTER PROC [dbo].[spa_R_TeamDetails]
@ReportsTo INT

AS
BEGIN
SET NOCOUNT ON
DECLARE @PersonId INT, @DisplayName VARCHAR(100)

SET @DisplayName = (SELECT DisplayName+'~'+CONVERT(VARCHAR,PersonId)+'~'+OrgEmpId TeamMembers
FROM Person WHERE PersonID = @ReportsTo)
PRINT REPLICATE('- ', (@@NESTLEVEL * 1)-1) + @DisplayName


SET @PersonId = (SELECT MIN(PersonId) FROM Person WHERE ReportsTo = @ReportsTo)

WHILE @PersonId IS NOT NULL
BEGIN
EXEC spa_R_TeamDetails @PersonId
SET @PersonId = (SELECT MIN(PersonId) FROM Person WHERE ReportsTo = @ReportsTo AND
PersonId > @PersonId)
END
END



-- spa_R_TeamDetails 1781
AnswerRe: Get hirarchy query Pin
ps_prakash0219-Aug-10 21:31
ps_prakash0219-Aug-10 21:31 
QuestionHow to query exclusion? SQL Help needed Pin
Kyudos16-Aug-10 17:36
Kyudos16-Aug-10 17:36 
AnswerRe: How to query exclusion? SQL Help needed Pin
Kyudos16-Aug-10 17:44
Kyudos16-Aug-10 17:44 
GeneralRe: How to query exclusion? SQL Help needed Pin
Mycroft Holmes16-Aug-10 18:22
professionalMycroft Holmes16-Aug-10 18:22 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos17-Aug-10 10:46
Kyudos17-Aug-10 10:46 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos17-Aug-10 13:18
Kyudos17-Aug-10 13:18 
GeneralRe: How to query exclusion? SQL Help needed Pin
Mycroft Holmes17-Aug-10 13:31
professionalMycroft Holmes17-Aug-10 13:31 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos18-Aug-10 11:10
Kyudos18-Aug-10 11:10 
GeneralRe: How to query exclusion? SQL Help needed Pin
Kyudos17-Aug-10 13:30
Kyudos17-Aug-10 13:30 
QuestionSelect and Update Pin
T.RATHA KRISHNAN15-Aug-10 20:53
T.RATHA KRISHNAN15-Aug-10 20:53 
AnswerRe: Select and Update Pin
Luc Pattyn16-Aug-10 0:22
sitebuilderLuc Pattyn16-Aug-10 0:22 
Questionaccess database Pin
sharmakamal14-Aug-10 7:45
sharmakamal14-Aug-10 7:45 
AnswerRe: access database PinPopular
Luc Pattyn14-Aug-10 8:59
sitebuilderLuc Pattyn14-Aug-10 8:59 
GeneralRe: access database Pin
PIEBALDconsult14-Aug-10 15:19
mvePIEBALDconsult14-Aug-10 15:19 
GeneralRe: access database Pin
Luc Pattyn14-Aug-10 15:24
sitebuilderLuc Pattyn14-Aug-10 15:24 
GeneralRe: access database Pin
PIEBALDconsult14-Aug-10 16:13
mvePIEBALDconsult14-Aug-10 16:13 
GeneralRe: access database Pin
Corporal Agarn17-Aug-10 1:10
professionalCorporal Agarn17-Aug-10 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.