Skip to main content

Posts

Showing posts with the label SQL Server Cursor

SQL Server Cursor

Summary:  From this post you will learn how to use  CURSOR  statement in SQL.  What is Database CURSOR:  A SQL Server cursor is a set of T-SQL logic to loop over a predetermined number of rows one at a time.  The purpose for the cursor may be to update one row at a time or perform an administrative process such as SQL Server database backups in a sequential manner.  SQL Server cursors are used for Development, DBA and ETL processes. Why Use a Cursor in SQL Server:   Although using an INSERT , UPDATE or DELETE statement to modify all of the applicable data in one transaction is generally the best way to work with data in SQL Server, a cursor may be needed for: Iterating over data one row at a time. Completing a process in a serial manner such as SQL Server database backups. Updating data across numerous tables for a specific account. Correcting data with a predefined set of data as the input to the cursor. When to Use a SQL Server Cursor: The ...

Popular posts from this blog