Collections:
"OPEN" - Executing the Query of a Cursor in SQL Server
How To Execute the Cursor Queries with "OPEN" Statements in SQL Server Transact-SQL?
✍: FYIcenter.com
Once a cursor is declared, you need to execute the query attached to the cursor so that the result set returned from the query can be accessed through the cursor. To execute the cursor query, you should use the OPEN statement as in this format:
OPEN cursor_name;
When you are done with using the result set attached to a cursor, you should close the result set to free up server resources.
The tutorial example below shows you how to open and close a cursor:
USE FyiCenterData; GO DECLARE fyi_cursor CURSOR FOR SELECT * FROM fyi_links; OPEN fyi_cursor; -- result set is ready to use -- other statements CLOSE fyi_cursor; DEALLOCATE fyi_cursor; GO
⇒ "FETCH" - Fetching the Next Row from a Cursor in SQL Server
⇐ "DECLARE ... CURSOR" - Declaring Cursor Objects in SQL Server
2016-10-17, 1277🔥, 0💬
Popular Posts:
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...
How To Look at the Current SQL*Plus System Settings in Oracle? If you want to see the current values...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...