We don't need no stinkin' cursors!

I was moved by the Tessi-Spirit this morn' to evangelize all ye SQL nuts out there.  If you have an interest in furthering your T-SQL skills, a good best practice to learn is how to avoid the use of cursors.  Here's a good demonstration of the overhead of using them:

http://www.sqlservercentral.com/articles/cursors/65040/

Parents
  • Good link Ryan.

    When setting up our development environment with a new copy of the live
    database, we run a procedure to delete or mangle any personally
    identifiable customer information, as the environment is not as secure as
    our others. The old procedure was a series of cursor driven while-loops
    running over each customer record. On the old hardware of our dev system
    it took upwards of eight hours. I attacked the procedure last month,
    stripping out all the cursors I could, and have brought it down to about
    twenty minutes.

    On 18 Jun 2010 09:16:54 -0500, "Ryan Creps"
    wrote:
    > I was moved by the Tessi-Spirit this morn' to evangelize all ye SQL nuts
    > out there.� If you have an interest in furthering your T-SQL skills, a
    > good best practice to learn is how to avoid the use of cursors.� Here's
    a
    > good demonstration of the overhead of using them:
    >
    > http://www.sqlservercentral.com/articles/cursors/65040/
    >
    > --
    > View this message online at
    > http://www.tessituranetwork.com/COMMUNITY/forums/p/2743/9326.aspx#9326
    [1]
    > or reply to this message
    > --
    > This message was sent automatically to you by www.tessituranetwork.com
    > because you subscribed to the Tessitura Technical Forum. You may reply
    to
    > this message to post to the Technical forum or visit the site to search,
    > read and post to the forums. In the interest of keeping the forum posts
    > from becoming cluttered, we encourage you to delete previous message
    text
    > from your reply before sending. Thank you!
    >
    > Links:
    > ------
    > [1]
    http://www.tessituranetwork.com/COMMUNITY/forums/p/2743/9326.aspx#9326

    --
    Gawain Lavers f. 510.643.6707
Reply
  • Good link Ryan.

    When setting up our development environment with a new copy of the live
    database, we run a procedure to delete or mangle any personally
    identifiable customer information, as the environment is not as secure as
    our others. The old procedure was a series of cursor driven while-loops
    running over each customer record. On the old hardware of our dev system
    it took upwards of eight hours. I attacked the procedure last month,
    stripping out all the cursors I could, and have brought it down to about
    twenty minutes.

    On 18 Jun 2010 09:16:54 -0500, "Ryan Creps"
    wrote:
    > I was moved by the Tessi-Spirit this morn' to evangelize all ye SQL nuts
    > out there.� If you have an interest in furthering your T-SQL skills, a
    > good best practice to learn is how to avoid the use of cursors.� Here's
    a
    > good demonstration of the overhead of using them:
    >
    > http://www.sqlservercentral.com/articles/cursors/65040/
    >
    > --
    > View this message online at
    > http://www.tessituranetwork.com/COMMUNITY/forums/p/2743/9326.aspx#9326
    [1]
    > or reply to this message
    > --
    > This message was sent automatically to you by www.tessituranetwork.com
    > because you subscribed to the Tessitura Technical Forum. You may reply
    to
    > this message to post to the Technical forum or visit the site to search,
    > read and post to the forums. In the interest of keeping the forum posts
    > from becoming cluttered, we encourage you to delete previous message
    text
    > from your reply before sending. Thank you!
    >
    > Links:
    > ------
    > [1]
    http://www.tessituranetwork.com/COMMUNITY/forums/p/2743/9326.aspx#9326

    --
    Gawain Lavers f. 510.643.6707
Children