Defining Cursors

If you have been using a computer for any length of time, you might be familiar with the term cursor. When a cursor is mentioned in relation to a computer, it generally means the blinking line that tells you were the next character will appear when you type. A cursor in terms of database access is a completely different concept. A database cursor is a programming feature that allows each row in a table to be processed separately from the rest of the rows in the result set. Another way to look at cursors is that they are the closest things you can get to an array when using T-SQL programming. This can be very useful when the rows in the table cannot be manipulated easily with the standard set of SQL commands.

The standard SQL commands ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition 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.