存储过程,把查询结果赋给变量

来源:互联网 发布:python mmap 编辑:程序博客网 时间:2024/05/21 10:48
declare upcur cursor for
select (datediff(day,@st_date,@ed_date)+1)-2*datediff(ww,@st_date,@ed_date) --每月要输的天数,没考虑节假日
open upcur --打开
fetch next from upcur into @work_days
   select @work_days
   fetch next from upcur into @work_days
close upcur --关
deallocate upcur