declare @UserName varchar(400) declare @EM varchar(400) declare pcurr cursor for select UserName, ErrorMessage from ErrorLog open pcurr fetch next from pcurr into @UserName,@EM while (@@fetch_status = 0) begin --set @Str=@Str+@ProductName print @UserName print @EM fetch next from pcurr into @UserName ,@EM end close pcurr