一个简单的SqlServer游标使用

Posted 蒹葭白露

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一个简单的SqlServer游标使用相关的知识,希望对你有一定的参考价值。

declare @id int
declare @name nvarchar(100)
declare c_department cursor for
  select id,name from department
open c_department
fetch next from c_department into @id,@name
while @@FETCH_STATUS=0
begin 
  --代码
  --代码
  fetch next from c_department into  @id,@name
end
close c_department
deallocate c_department

 

以上是关于一个简单的SqlServer游标使用的主要内容,如果未能解决你的问题,请参考以下文章