如果要取出每记录的值,用游标declare @var sql_variantdecalre your_cursor cursor for select fieldname from 一张表 where ... open your_cursor fetch next from your_cursor into @var while @@fetch_status = 0 begin --处理@var fetch next from your_cursor into @var end close your_cursor deallocate your_cursor
open your_cursor
fetch next from your_cursor into @var
while @@fetch_status = 0
begin
--处理@var
fetch next from your_cursor into @var
end
close your_cursor
deallocate your_cursor