Click here to Skip to main content
15,877,103 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to get the first rows of a relational table (depending of the last date of change) Pin
leoinfo16-Jul-08 4:29
leoinfo16-Jul-08 4:29 
AnswerRe: How to get the first rows of a relational table (depending of the last date of change) Pin
leoinfo16-Jul-08 4:39
leoinfo16-Jul-08 4:39 
GeneralRe: How to get the first rows of a relational table (depending of the last date of change) Pin
fracalifa16-Jul-08 4:56
fracalifa16-Jul-08 4:56 
QuestionHow to Make Application to Sync on Remote Site Pin
Nassoro Ally16-Jul-08 0:39
Nassoro Ally16-Jul-08 0:39 
QuestionReports are not visible on client machine Pin
meetaqadir15-Jul-08 20:54
meetaqadir15-Jul-08 20:54 
QuestionOLEDB with Excel problem Pin
acroitoriu15-Jul-08 20:52
acroitoriu15-Jul-08 20:52 
AnswerRe: OLEDB with Excel problem Pin
acroitoriu15-Jul-08 21:23
acroitoriu15-Jul-08 21:23 
Questionfacing probs in nested cursor Pin
Member 387988115-Jul-08 19:56
Member 387988115-Jul-08 19:56 
Hi i am facing problem in nested cursor...,
In this first cursor for managers and second one is for employee details...,

Its going on well..,

But the employee detail it binding the all the managers, last record of employee at 2 times...,

but i want to bind those also at one time...,

See i given my procedure on down side:
pLz tell me what wrong in that?,


DECLARE curMgr CURSOR FOR

SELECT distinct ManagerID FROM @tbl_TempManagers

OPEN curMgr
FETCH NEXT FROM curMgr INTO @mgID

Insert Into @tbl_TempEmployee Select MId,ID,UserName,EId from tbl_login Where Mid=@mgid

WHILE (@@FETCH_STATUS = 0 )
BEGIN
SET @EmpDetail = ''

SELECT @Count=Count(*) FROM @tbl_TempEmployee
--
SET @Counter=1

DECLARE curDetailList CURSOR FOR
SELECT distinct EmployeeName from @tbl_Tempemployee where ManagerId = @mgID

OPEN curDetailList

FETCH NEXT FROM curDetailList INTO @EmployeeName1

SELECT
convert(varchar(20),TSDate,101) as [Date],TSSubject as [Subject],TSDescription as [Description],
TSHour as [Hour],TSMin as [Minute],convert(varchar(20),CreationDate,101) as [Creation Date],
CreationBy as [Name Of Employee] FROM tbl_TSEnterData where CreationBy=@employeename1
AND TSDate BETWEEN
CONVERT( NVARCHAR, DATEADD(wk, -1, @d) , 101) AND CONVERT( NVARCHAR, DATEADD(dd, -1, @d) , 101)
order by CreationBy asc,TSDate Desc

WHILE (@@FETCH_STATUS = 0 AND @Counter<@Count)
BEGIN


SET @EmpDetail = @EmpDetail + @EmployeeName1 + ', '
FETCH NEXT FROM curDetailList INTO @EmployeeName1

SELECT
convert(varchar(20),TSDate,101) as [Date],TSSubject as [Subject],TSDescription as [Description],
TSHour as [Hour],TSMin as [Minute],convert(varchar(20),CreationDate,101) as [Creation Date],
CreationBy as [Name Of Employee] FROM tbl_TSEnterData where CreationBy=@employeename1
AND TSDate BETWEEN
CONVERT( NVARCHAR, DATEADD(wk, -1, @d) , 101) AND CONVERT( NVARCHAR, DATEADD(dd, -1, @d) , 101)
order by CreationBy asc,TSDate Desc

SET @counter=@counter+1
END
CLOSE curDetailList
DEALLOCATE curDetailList
INSERT INTO @Result VALUES (@mgID, @EmpDetail)
FETCH NEXT FROM curmgr INTO @mgID
Insert Into @tbl_TempEmployee Select MId,ID,UserName,EId from tbl_login Where Mid=@mgid

END
CLOSE curmgr
DEALLOCATE curmgr


Thanks & Regards,
NeW OnE,
please don't forget to vote on the post

modified on Wednesday, July 16, 2008 2:52 AM

AnswerRe: facing probs in nested cursor Pin
Alsvha15-Jul-08 23:28
Alsvha15-Jul-08 23:28 
Questionbytes retrieval Pin
vicki52815-Jul-08 18:19
vicki52815-Jul-08 18:19 
AnswerRe: bytes retrieval Pin
Alsvha15-Jul-08 23:28
Alsvha15-Jul-08 23:28 
QuestionHow do i convert a varchar field into the datetime data type Pin
Rameez Raja15-Jul-08 18:12
Rameez Raja15-Jul-08 18:12 
AnswerRe: How do i convert a varchar field into the datetime data type Pin
Alsvha15-Jul-08 23:31
Alsvha15-Jul-08 23:31 
QuestionDATABASE CONNECTIVITY Pin
murphy7715-Jul-08 15:58
murphy7715-Jul-08 15:58 
AnswerRe: DATABASE CONNECTIVITY Pin
Ashfield15-Jul-08 21:45
Ashfield15-Jul-08 21:45 
QuestionConnecting to an ODBC DataSource Pin
ffowler15-Jul-08 14:17
ffowler15-Jul-08 14:17 
QuestionDatabase Publishing Wizard alternatives Pin
Todd Smith15-Jul-08 9:15
Todd Smith15-Jul-08 9:15 
AnswerRe: Database Publishing Wizard alternatives Pin
Alsvha15-Jul-08 23:34
Alsvha15-Jul-08 23:34 
Questionautomatica fire event Pin
Member 387988115-Jul-08 4:12
Member 387988115-Jul-08 4:12 
AnswerRe: automatica fire event Pin
Mark J. Miller15-Jul-08 7:07
Mark J. Miller15-Jul-08 7:07 
QuestionHow to make subreport display based on data Pin
imranafsari15-Jul-08 1:25
imranafsari15-Jul-08 1:25 
AnswerRe: How to make subreport display based on data Pin
TheFM23415-Jul-08 5:33
TheFM23415-Jul-08 5:33 
QuestionResetting Identity Column in oracle Pin
meeram39514-Jul-08 23:45
meeram39514-Jul-08 23:45 
AnswerRe: Resetting Identity Column in oracle Pin
scottgp15-Jul-08 3:58
professionalscottgp15-Jul-08 3:58 
QuestionConfigure SQL 2005 For Remote Connection Pin
swjam14-Jul-08 23:43
swjam14-Jul-08 23:43 

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.