max number of rows in a cursor (mssql 2005)

  • My problem: I have a table with 100.000 rows. I need to perform some actions on every row in the table. I decide to use the cursors. I this a good idea? Is were another solution?

    What is the max number of rows that I can store in a cursor variable?

    thanks for help

  • Dont use cursors they will perform horrblbly, try and look for a set-based solution.

    If you post your table defs , some sample data and what you want to do, then i am sure someone will be able to help you.

  • dana_turcanu1981 (2/20/2009)


    I need to perform some actions on every row in the table. I decide to use the cursors. I this a good idea?

    On 100 000 rows? Pack lunch, it's going to take a while to run.

    Is were another solution?

    Maybe. If you tell us what you're doing on each row, maybe someone can give you al alternative.

    What is the max number of rows that I can store in a cursor variable?

    I don't think there's a limit.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • .... It's not good what you are telling me....

    In what case it's reasonable to use cursors?

    My table contains varchar(50) and int columns. For each row I need to verify the data correctitude by calling some functions (I'm not calling all functions at once, but I'm calling a function, verify something and raise error if it's the case). I can try to group my rows (each group will have 700-800 rows), but I don-t like this solution.

    What do you meen by " a set-based solution"?

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

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