difference between cursor and for loop in sql

Posted by Rajesh081725 under Sql Server on 6/8/2017 | Points: 10 | Views : 211 | Status : [Member] | Replies : 2
difference between cursor and for loop in sql

Thanks,
Rajesh kumar

Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.



Responses

Posted by: Qyam on: 6/9/2017 [Member] Starter | Points: 25

Up
0
Down
there is no for loop in sql. We do have while loop.

Rajesh081725, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 6/10/2017 [Member] [MVP] Starter | Points: 25

Up
0
Down
Cursor is used to iterate result set and it can be fetched previous/next values which allocates new memory in database engine. For loop is a general straight forward mechanism to iterate each records only. Follow link for more details-
https://www.sqlservercentral.com/Forums/Topic1006409-391-1.aspx

Jitendra Kumar
If my post helps you, plz mark as an answer.

Rajesh081725, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response