@@CURSOR_ROWS -m Flag

  • Comments posted to this topic are about the item @@CURSOR_ROWS -m Flag

  • Nice question, thanks Miles

    Learned something today, as i seldom use cursors...

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • This is not a correct answer. There's no -m flag. From the documentation, @@cursor_rows returns -m if the cursor is being asynchronously populated. That just means a negative value m is returned by the function. There are no flags to send to the function.

    Sql Server blog: http://www.tsql.nu

  • Hi Miles. Given the timing of this question, it is possible that it's an April Fools joke.  But, just in case it is serious, as well as for those that take it seriously even if it is meant as a joke, it should be clarified that (some of it already stated by @Magnus):

     

    1. This clearly wasn't tested (assuming that this was meant as a serious question) as a simple test would make it quite clear that option C (there is no -m flag) is correct.
    2. In programming in general, "flags" do not apply to functions. Functions take parameters. Flags apply to command-lines (i.e. options you pass in a shell to a program).
    3. This is a major misread of the linked documentation, which clearly states that "-m" is a return value, not a flag or parameter.
    4. In the "Remarks" section, the documentation even clarifies what causes a negative return value:

      "Keyset-driver or static cursors open asynchronously if the value for sp_configure cursor threshold exceeds 0, and the number of rows in the cursor result set exceeds the cursor threshold."

    5. Regarding the statement, "It makes the cursor populate asynchronously", in the explanation of the answer: this function reports what happened; it has no way to control what will happen. (I believe this is the case for all @@ functions)

     

    Take care,

    Solomon...

     

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR

  • I agree with magnus that -m is not a flag for the @@CURSOR_ROW function, i only indicates in BOL that a negative value returned by the function indicates that the cursor populates asynchronously and has M rows currently in the keyset.

    Louis

  • Magnus Ahlkvist wrote:

    This is not a correct answer. There's no -m flag. From the documentation, @@cursor_rows returns -m if the cursor is being asynchronously populated. That just means a negative value m is returned by the function. There are no flags to send to the function.

    +1

  • Well, I managed to guess how the author arrived at what was designated as the correct answer. But clearly, that is a gross misunderstanding of the cited article from BOL.


    Just because you're right doesn't mean everybody else is wrong.

Viewing 7 posts - 1 through 6 (of 6 total)

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