Stairway to Advanced T-SQL

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

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.

Blogs

What’s New at AWS re:Invent 2025 – Day 1 Highlights

By

Day 1 is an absolute thrill at re:Invent! I normally dedicate this dynamic day...

Running SQL Server on KubeVirt – Getting Started

By

With all the changes that have happened with VMware since the Broadcom acquisition I...

Why is shrinking IT budgets a good thing?

By

Each year around this time, companies enter the familiar ritual of budgeting. For many,...

Read the latest Blogs

Forums

Adding a Lot of Seconds

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Adding a Lot of Seconds

SQL Server Licensing is Simple

By Steve Jones - SSC Editor

Comments posted to this topic are about the item SQL Server Licensing is Simple,...

Stairway to Azure SQL Hyperscale Level 5: Data Growth and Fast Auto-Grow Mechanism

By Chandan Shukla

Comments posted to this topic are about the item Stairway to Azure SQL Hyperscale...

Visit the forum

Question of the Day

Adding a Lot of Seconds

When does this code work and when does it fail?

DECLARE @BaseDate DATETIME = '1900-01-01';

SELECT DATEADD(SECOND, 2147483648, @BaseDate) AS [MaxIntSecondsAdded];

See possible answers