Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
set nocount on
use AdventureWorks2012
declare @total money
declare @cursor CURSOR
set @cursor = cursor for
select top 10 TotalDue
from sales.SalesOrderHeader
order by SalesOrderID desc
open @cursor
fetch next from @cursor into @total
while @@FETCH_STATUS = 0
print 'total :'+cast(@total as varchar)
fetch next from @cursor into @total
close @cursor
deallocate @cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.