cursors

Stairway to Advanced T-SQL

Stairway to Advanced T-SQL Level 4: Record Level Processing Using Transact-SQL Cursors

  • Stairway Step

Using a CURSOR is not normally the best way to process through a set of records. Yet when a seasoned programmer moves to writing TSQL for the first time they frequently look for ways to process a sets of records one row at a time. They do this because they are not used to thinking about processing records as a set. In order to process through a TSQL record set a row at a time you can use a cursor. A cursor is a record set that is defined with the DECLARE CURSOR statement. Cursors can be defined as either read-only or updatable. In this article I will introduce you to using cursors to do record level processing one row at a time.

4 (1)

2021-04-14 (first published: )

11,624 reads

Blogs

Creating a user for a STONITH resource in vSphere

By

I previously blogged about how to create a STONITH resource for a pacemaker cluster...

Default event_file path for Extended Events

By

Foreword Have you ever wondered where the .xel file is saved when you create a...

Query Store Hints in SQL Server 2022

By

Another neat little feature in SQL Server 2022 is Query Store Hints. This is...

Read the latest Blogs

Forums

Display Top N values of a table with calculation next to it

By Soof1234

Hi, In Power BI Report Builder I need to use SSRS code for my...

Package runs in Debug mode but fails otherwise

By Alexp012

Hi We have a SSIS package that uploads data to Blob storage. The package...

Can anyone suggest a plan with backup full and backup log without backup diff ?

By vpmaciel

I need only one backup full at mid night, and one backup log each...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers