Row-by-Row Versus Set-Oriented Processing

You can apply a specific business process to a group of rows, in two completely different ways:

  • Navigate the result set in the way you prefer, and apply the business process to every row individually, sending one or more Transact-SQL statements to SQL Server for every row.

  • Send to SQL Server a single Transact-SQL statement that describes how to apply the business process to the entire result set, and let SQL Server decide how to apply it, in the optimal way.

I'll explain the difference between these two ways with a practical example.

Consider it is the end of the year and you want to increase product prices by 5%. The manual process will involve modifying each product's UnitPrice. The automatic process ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.