• As others already mentioned, sp_decribe_cursor is a typo. A so obvious typo that I didn't even catch it until I saw it being mentioned in the comments here. I can't imagine anyone getting the answer wrong because of that. 🙂

    Far more serious is the concern raised by Mike C. A concern I wanted to raise myself. The answer says that I can get the number of rows in the result of a cursor by couting rows returned by sp_describe_cursor_columns. However, this stored procedure returns one row per column in the result set of the cursor, not one per row. So I fail to see how counting the rows returned by this system stored procedure will learn me anything but the number of columns, rather than rows, in the cursor.

    Of course, best practice would be to never use cursors at all - except for the 0.001% of all problems where a cursor does outperform a setbased solution. 😉


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/