游标定义
2011-09-06 15:04 Eric.Hu 阅读(187) 评论(0) 编辑 收藏 举报游标定义
declare @salaryitemid int
declare salaryitem_cursor cursor
for
select salaryitemid from payroll.salaryitem where companyid = @companyid order by salaryitemid
open salaryitem_cursor
fetch next from salaryitem_cursor into @salaryitem
while (@@fetch_status<>-1)
begin
-----------
fetch next from salaryitem_cursor into @salaryitemid
end
close salaryitem_cursor
declare salaryitem_cursor cursor
for
select salaryitemid from payroll.salaryitem where companyid = @companyid order by salaryitemid
open salaryitem_cursor
fetch next from salaryitem_cursor into @salaryitem
while (@@fetch_status<>-1)
begin
-----------
fetch next from salaryitem_cursor into @salaryitemid
end
close salaryitem_cursor
deallocate salaryitem_cursor
借沉浮的
着意耕耘,自有收获。