如何从存储过程中得到一组数据
我有一个存储过程,现在可以得到一个日期型的数据:
过程如下:
1 create procedure gettabdateweek
2 @tabdate smalldatetime Output --输出时间
3 as
4 declare @flag int
5 declare @curdate smalldatetime --当前时间
6 declare @searchtabday smalldatetime --光标指示的记录集中的时间字段
7 declare searchday scroll cursor for --查询记录集中的时间字段的光标
8 select tabday from temp_08 --temp_08为数据库中的基本表 ,tabday为该表的一个日期型字段
9 order by tabday desc
10 for read only
11 set @curdate=getdate()
12 open searchday
13 fetch first
14 from searchday
15 into @searchtabday
16 while (datediff(week,@searchtabday,@curdate)>=0) begin
17 set @flag=0
18 if (year(@searchtabday)=year(@curdate) and month(@searchtabday)=month(@curdate) and day(@searchtabday)=day(@curdate)) 19 begin
20 set @flag=1
21 if (DATEPART (weekday ,@searchtabday)=5) begin
22 set @tabdate=@searchtabday break
23 end
24 end
25 if (datediff(week,@searchtabday,@curdate)>0 and @flag=0) begin
26 set @tabdate=@searchtabday break
27 end
28 fetch next
29 from searchday
30 into @searchtabday
31 end
32 close searchday
33 deallocate searchday
说明: 以上只能返回数据@tabdate 即在22行或26行返回,如果我想返回一组数据,即把数据表temp_08中所有满足条件的数据都取出来并返回 ,供客户端 asp 页面来调用 请问以上的存储过程应该如何修改