Click here to Skip to main content
15,936,247 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to insert data from MS SQL server in MS EXCEL Sheet? Pin
leoinfo17-Jul-08 5:17
leoinfo17-Jul-08 5:17 
GeneralRe: How to insert data from MS SQL server in MS EXCEL Sheet? Pin
guriqbal8720-Jul-08 20:50
guriqbal8720-Jul-08 20:50 
AnswerCross Post Pin
Paul Conrad17-Jul-08 16:51
professionalPaul Conrad17-Jul-08 16:51 
QuestionSending Email Pin
jonhbt17-Jul-08 3:38
jonhbt17-Jul-08 3:38 
AnswerRe: Sending Email Pin
Wendelius17-Jul-08 8:06
mentorWendelius17-Jul-08 8:06 
QuestionNested Cursor loop problem Pin
Member 387988117-Jul-08 3:25
Member 387988117-Jul-08 3:25 
AnswerRe: Nested Cursor loop problem Pin
Mark J. Miller17-Jul-08 9:27
Mark J. Miller17-Jul-08 9:27 
GeneralRe: Nested Cursor loop problem [modified] Pin
Member 387988117-Jul-08 19:59
Member 387988117-Jul-08 19:59 
Hi as per our discussion i modified slightly that cursor

Now its creating problem in second manager entry that employee record only binding more than one:

Its modified cursor look at this:

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 order by EmployeeName

OPEN curDetailList

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

SELECT dbo.tbl_Login.MID,

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
INNER JOIN
dbo.tbl_Login ON dbo.tbl_TSEnterData.CreationBy = dbo.tbl_Login.UserName
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
FETCH NEXT FROM curDetailList INTO @EmployeeName1


END
CLOSE curDetailList
DEALLOCATE curDetailList

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 Friday, July 18, 2008 3:27 AM

GeneralRe: Nested Cursor loop problem Pin
Mark J. Miller18-Jul-08 5:20
Mark J. Miller18-Jul-08 5:20 
QuestionCompact database not working Pin
krishnan.s17-Jul-08 2:41
krishnan.s17-Jul-08 2:41 
AnswerRe: Compact database not working Pin
Paul Conrad17-Jul-08 16:51
professionalPaul Conrad17-Jul-08 16:51 
QuestionNot In operation? Pin
Member 387988117-Jul-08 1:03
Member 387988117-Jul-08 1:03 
AnswerRe: Not In operation? Pin
TheFM23417-Jul-08 3:00
TheFM23417-Jul-08 3:00 
GeneralRe: Not In operation? Pin
Member 387988117-Jul-08 3:09
Member 387988117-Jul-08 3:09 
Questionselect datas using union operation Pin
deepthy.p.m16-Jul-08 22:48
deepthy.p.m16-Jul-08 22:48 
AnswerRe: select datas using union operation Pin
Vimalsoft(Pty) Ltd17-Jul-08 0:50
professionalVimalsoft(Pty) Ltd17-Jul-08 0:50 
Questionreturn Table name + Column Name in sql query Pin
farabba16-Jul-08 20:51
farabba16-Jul-08 20:51 
AnswerRe: return Table name + Column Name in sql query Pin
Harvey Saayman16-Jul-08 23:01
Harvey Saayman16-Jul-08 23:01 
GeneralRe: return Table name + Column Name in sql query Pin
Mycroft Holmes17-Jul-08 20:08
professionalMycroft Holmes17-Jul-08 20:08 
GeneralRe: return Table name + Column Name in sql query Pin
Harvey Saayman17-Jul-08 20:19
Harvey Saayman17-Jul-08 20:19 
GeneralRe: return Table name + Column Name in sql query Pin
Mycroft Holmes17-Jul-08 20:44
professionalMycroft Holmes17-Jul-08 20:44 
AnswerRe: return Table name + Column Name in sql query Pin
MBCDC21-Jul-08 0:39
MBCDC21-Jul-08 0:39 
Questiondynamically applyin styles based on DB Value to reports Pin
ch.ramesh16-Jul-08 19:06
ch.ramesh16-Jul-08 19:06 
AnswerRe: dynamically applyin styles based on DB Value to reports Pin
Ashfield16-Jul-08 20:13
Ashfield16-Jul-08 20:13 
GeneralRe: dynamically applyin styles based on DB Value to reports Pin
ch.ramesh16-Jul-08 20:21
ch.ramesh16-Jul-08 20:21 

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.