Please give me the answer. (The requirement: fetch 1000 rows) I don't know whether the 'DECLARE CURSOR' statement supply a parameter to define the '1000' or not.
is it possable for you to do record count and then set up a for loop with a count up to 1000 every time the cursor is executed add 1 to the count.
Thank you for your reply.But this is not the answer that I want! I just need to avoid the loop!
If you simply want to retrieve 1000 rows try using : select top 1000 field_name from table_name order by your_criteria But if you actually want to pass 1000 rows through a cursor you could create an incrementing variable and stop the cursor when it reaches 1000.
You should be able to limit the number of rows returned by issueing the following prior to your select statement: SET ROWCOUNT 1000 This will return only 1000 rows.
Steve Jimmo DBA Sybase, MS SQL Server
Forum Rules