Thanks Tony and the other that tried to help me out.. Down here is the code that is working ,The only thing I did was to change the order of operation in the cursors I'm using.I wonder why this is the solution??????. Besides although I 'm getting the data I need at the end the stored procedure report this error:Server: Msg 241, Level 16, State 1, Procedure InfoEkSelfASS1, Line 119 Syntax error converting datetime from character string.
Any ideas?? regards and Thanks a thousand Mario down here the new code CREATE proc dbo.InfoEkSelfASS1 as begin /*Declring local variables*/ DECLARE @UsernameAux VARCHAR(255), @FirstNameAux VARCHAR(255), @LastNameAux VARCHAR(255), @TitleAux VARCHAR(255), @TutorialTitleAux VARCHAR(255), @QuestionNumberAux INT, @StudentAnsweredCorrectlyAux VARCHAR(255) , @StudentAnsweredCorrectlyAux1 INT, @AssessmentStartTimeAux DATETIME, @CompletedAux VARCHAR(255), @CompletedAux1 INT, @DurationAux INT, @FistAccessAux DATETIME, @LastAccessAux DATETIME, @Count INT /* deleting the previous table(Final result) */ DELETE FROM ElementkSelfSRpt /*This is in case there is no data in EkSelfAssRpts and there is in EkSelfTutorialRpts*/ /* Creating one cursor for the table assessment*/ DECLARE assessm_curt CURSOR FOR SELECT Username, FirstName, LastName,Title,TutorialTitle FROM EkSelfTutorialRpts FOR READ ONLY OPEN assessm_curt FETCH assessm_curt INTO @UsernameAux, @FirstNameAux, @LastNameAux, @TitleAux, @TutorialTitleAux WHILE @@FETCH_STATUS =0 begin /*SELECT @Count=COUNT(UserName) FROM EkSelfAssRpts WHERE UserName=@UsernameAux AND FirstName=@FirstNameAux AND Title=@TitleAux*/ IF NOT EXISTS ( SELECT DISTINCT UserName FROM EkSelfAssRpts WHERE UserName=@UsernameAux AND FirstName=@FirstNameAux AND Title=@TitleAux) begin /*If I 'm here is because I found one without assessment*/ EXEC InfoEkSelfDuration @UserName=@UsernameAux, @Title=@TitleAux, @Duration= @DurationAux output EXEC InfoEkSelfLT @UserName=@UsernameAux, @Title=@TitleAux, @LastAccess= @LastAccessAux output EXEC InfoEkSelfST @UserName=@UsernameAux, @Title=@TitleAux, @FistAccess = @FistAccessAux output EXEC InfoEkSelfComp @UserName=@UsernameAux, @Title=@TitleAux, @Completed= @CompletedAux1 output IF @CompletedAux1 =1 SELECT @CompletedAux="Yes" ELSE SELECT @CompletedAux="No" SELECT @AssessmentStartTimeAux=null SELECT @QuestionNumberAux=0 SELECT @StudentAnsweredCorrectlyAux="No" INSERT ElementkSelfSRpt (Username, [First Name],[Last Name],Title , [Tutorial Title], [Question Number] , [Student Answered Correctly],[Assessment Start Time], Completed , Duration , FistAccess,LastAccess ) VALUES(@UsernameAux, @FirstNameAux ,@LastNameAux, @TitleAux , @TutorialTitleAux , @QuestionNumberAux , @StudentAnsweredCorrectlyAux , @AssessmentStartTimeAux , @CompletedAux, @DurationAux, @FistAccessAux, @LastAccessAux ) end FETCH assessm_curt INTO @UsernameAux, @FirstNameAux, @LastNameAux, @TitleAux, @TutorialTitleAux end > /////////////////////////////// > > --- [EMAIL PROTECTED] escribió: > i need the > table schema for ElementkSelfSRpt. > > > > Anthony Petruzzi > > Webmaster > > 954-321-4703 > === message truncated === _________________________________________________________ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists