>How does work the function @@cursor_rows ???
@@CURSOR_ROWS return the number of rows in the cursor. The reason that you're getting a -1 is because a dynamic cursor was created. From the SQL BOL:
(-1) The cursor is dynamic. Because dynamic cursors reflect all changes, the number of rows that qualify for the cursor is constantly changing. It can never be definitely stated that all qualified rows have been retrieved.
To get the results that you're looking for, add the INSENSITIVE clause:
declare dave INSENSITIVE cursor for
select * from syst_msg
-Mike