Programming in MS SQL Server 2012 |
Open CursorOpens a Transact-SQL server cursor and populates the cursor by executing the Transact-SQL statement specified on the DECLARE CURSOR or SET cursor_variable statement. The following example describes to open a declared cursor to start query execution. --
Example 144 -- DECLARE EmployeeList
CURSOR FOR SELECT
EMP.Emp_Code,
EMP.Emp_Name,
EMP.Salary,
EMP.Dept_Code,
DEPT.Dept_Name FROM EMP INNER JOIN DEPT ON EMP.Dept_Code = DEPT.Dept_Code OPEN EmployeeList |
* * * * *