DEALLOCATEDECLARE @MyCursor CURSOR
SET @MyCursor = CURSOR LOCAL SCROLL FOR
SELECT * FROM Sales.SalesPersonDEALLOCATE @MyCursor
SET @MyCursor = CURSOR LOCAL SCROLL FOR
SELECT * FROM Sales.SalesPersonDEALLOCATE @MyCursor
select .. from tablename where ...
open cur
fetch next from cur into 变量
while @@fetch_status=0
begin
要做的处理
end
close cur
deallocate cur
游标的标准写法
DEALLOCATE Cursor_nam//释放游标