Regarding cursors

  • Hi all,

    I ran a cursor (XYZ) to delete some records from a table.

    Can we somehow track

    cursor name

    cursor ran date time

    cursor duration (ran time)

    affected tables

    affected records

    or atleast some of the abov

    Means any king of log thing or anything we can track?

  • Is there a reason why you are using cursors to delete records, or are you just experimenting?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • See if this can help you http://msdn.microsoft.com/en-us/library/cc280663.aspx though i dont have concrete reply for your post

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • sqlpassion (1/2/2011)


    Hi all,

    I ran a cursor (XYZ) to delete some records from a table.

    Can we somehow track

    cursor name

    cursor ran date time

    cursor duration (ran time)

    affected tables

    affected records

    or atleast some of the abov

    Means any king of log thing or anything we can track?

    The server level audits and the default trace won't catch this stuff. You need to actually build most of it into the code you're running. As an alternative, you might be able to catch this stuff in SQL Profiler but then you'd need to make sure profiler was running whenever you ran the code.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply