begin tran tran_2011_5_13
/**定义游标**/
Declare Cur Cursor For select fid from PolygonCountry
Declare @fid int
/**打开游标**/
open Cur
Fetch next From Cur Into @fid
While @@fetch_status = 0
begin
/**DML/DDL**/
update PolygonCountry set project_counts=cast( floor(rand()*100) as int) where fid=@fid
Fetch next From Cur Into @fid
end
Close Cur
Deallocate Cur
select * from PolygonCountry
/**回滚**/
rollback tran tran_2011_5_13
/**提交**/
commit tran tran_2011_5_13
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23676909/viewspace-695664/
,如需转载,请注明出处,否则将追究法律责任。