Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Expand JoinsJoins
Expand TriggerTrigger
Collapse CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Expand FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

Fetch

 
      DECLARE myCursor CURSOR
      LOCAL
      FOR SELECT Name, Country FROM EMP

      DECLARE @Name char(20), @Country char(50)

      OPEN myCursor

      FETCH myCursor
            INTO @Name, @Country

      SELECT @Name,@Country

      CLOSE       myCursor

      DEALLOCATE  myCursor