Firehose cursor and filling arrays | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Firehose cursor and filling arrays

I know that for best performance should use a firehose cursor if only retrieving data (to fill in a list box, for example).
The prblem i have is that I have to fill in an array and of course i don’t know the number of records i will fetch with my query. Using a firehose cursor (being it server side) I cannot use the RecordCount property of the recordset object, so I cannot dimension the array I have to fill. using a Redim for each iteration is a bad idea, of course? Any solution? The only one i can think of is to dimension the array to a very big dimension (like 1000, I know i have less than 1000 records) and use a counter to count the iterations to fill in the array, and then redim it to the correct size.
Use a client-side disconnected cursor to fill ADO’s own cursor engine with data (in firehose mode). Then you can use RecordCount. This is often recommended in a web environment. For a description of cursors see my reply here: