DECLARE @customerId int,
@firstName nvarchar(255)
DECLARE Customer CURSOR FOR
SELECT customerId,
firstName,
FROM CustomerTable
OPEN Customer
FETCH Customer INTO @customerId,
@firstName
WHILE @@Fetch_Status = 0
BEGIN
-- row by row operations
Print
FETCH Customer INTO @customerId,
@firstName,
@vchCustomerName
END
CLOSE Customer
DEALLOCATE Customer
Go