Let’s look at a simple example of using cursors. In SQL server So there are different types of cursors But remember, most of the time Cursors can be very easily replaced using joins. Since cursors operate on a row by row basis, they can be extremely slow. But however, if there is a need for us to process the rows on a row by row basis, then cursors can be used.Ĭursors are very bad for performance and they should always be avoided. In fact, in SQL statements like UPDATE, delete, select, etc., they handle data and sets in a very efficient way. Update TblDonation Set DonationAmount = 100 where StudentId = 150Īll the rows in TblDonation which meet the conditions in the where clause will have the DonationAmount updated to 100 at a single set and SQL server very efficient at operating on data in SETS. (įor example, consider the below update statement. Script Date: 8:18:26 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |