MS SQL Server Concepts and Programming Question:
Download Job Interview Questions and Answers PDF
What Are Cursors in MS SQL Server?
Answer:
A cursor is a special data type that represents a result set returned by a SELECT query statement. There are several notes about cursor you need to remember:
* Cursor data type can not be used to define table columns.
* Cursor data type is used on store procedures, functions, and triggers to help you loop through result sets returned by queries.
* Cursor data type can be used to define cursor variables.
* There are special Transact-SQL statements dedicated to work with cursors variables: OPEN, FETCH, CLOSE, and DEALLOCATE.
* Cursor variables can be passed as procedure or function parameters.
* There is a special function, CURSOR_STATUS(), for check cursor statuses.
* Cursor data type can not be used to define table columns.
* Cursor data type is used on store procedures, functions, and triggers to help you loop through result sets returned by queries.
* Cursor data type can be used to define cursor variables.
* There are special Transact-SQL statements dedicated to work with cursors variables: OPEN, FETCH, CLOSE, and DEALLOCATE.
* Cursor variables can be passed as procedure or function parameters.
* There is a special function, CURSOR_STATUS(), for check cursor statuses.
Download MS SQL Server Interview Questions And Answers
PDF
Previous Question | Next Question |
Can You Create a Logon Trigger in SQL Server 2005 Express Edition? | How To Declare a Cursor with "DECLARE ... CURSOR" in MS SQL Server? |