sql 游标的简单作用

作者在 2006-08-25 22:46:00 发布以下内容
一个简单的例子,拿去参考
CREATE procedure Derive_ledger
as
declare @BlockId char(2)
declare bId cursor
  for select BlockId
        from Blocks
  for Read Only
  open bId
  fetch bId into @BlockId
  while @@FETCH_STATUS=0
    begin
     exec Derive_ledger_1 @BlockId
     fetch next from bId  
       into @BlockId
    end
  close bId
 
  DEALLOCATE bId
SQL SERVER 2000 | 阅读 1016 次
文章评论,共0条
游客请输入验证码
浏览92514次