BEGIN DECLARE YourCursor CURSOR FOR SELECT Column1 FROM YourTable WHERE ... FOR READ ONLY END ELSE BEGIN DECLARE YourCursor CURSOR FOR SELECT ColumnB FROM YourTable WHERE ... FOR READ ONLY END --populate and allocate resources to the cursor OPEN YourCursor
--process each row WHILE 1=1 BEGIN
FETCH NEXT FROM YourCursor INTO @FetchColumn
--finished fetching all rows? IF @@FETCH_STATUS <> 0 BEGIN --YES, all done fetching --exith the loop BREAK END --IF finished fetching