From the course: SQL Server Performance for Developers

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

What to do instead of cursors

What to do instead of cursors - SQL Server Tutorial

From the course: SQL Server Performance for Developers

Start my 1-month free trial

What to do instead of cursors

- [Instructor] We've talked about how cursors and while loops are bad operations and why you shouldn't do them, but we didn't exactly show a lot of detail on how to do this better in a set-based fashion. We've talked about it, but here let's take a look at some examples of what you can do instead of cursors. So there are a lot of join types and join operations in SQL Server whether we're talking about inner joins which will bring back records that equal each other or left adder joins which will bring back all records that maybe don't even include a match. It also helps to understand how temporary objects in SQL Server work and where you should use temp tables and global temp tables and table-valued functions and parameters. Later in the course, there will be a module where we'll talk specifically about those objects and how you can use them and choose which one most effectively, but those are really your weapons of choice to do in lieu of cursors. You have the full range of join…

Contents