Posts

Showing posts with the label cursor

SQL Server: Cursors explained in a simple way. A trick before Christmas: how to make Cursors work faster!

Image
 Hi guys, Welcome back mates and happy sunday! Today an interesting post awaits us. Christmas is coming and so today free tricks for everyone! The trick of today is how to make cursors work faster . But first we will see what cursors are ( i know, there are a couple of posts that I don't talk about theory and I would not want you to lose the habit ... haha )   A personal premise: cursors are not known to be fast and I honestly don't find situations where it is preferable to use them. This is because I have this important concept in mind :  If we really want to help SQL Server execute queries, it is very important to pay attention to using "set-based logic" rather than single-line logic .  Why updating a table by making an update for each row when making a single one involving all the rows is certainly faster? But first let me give you a little introduction to the cursors.     Enjoy the post mates ...enjoy it! What is a cursor What is a cursor?  Wi...