• go ahead and throw your cursor away.

    the data you are looking for is already materialized for you;

    the indexes maintain a count of the number of rows for every table.

    try this and see if it's not doing exactly what you were trying to do with your cursor:

    SELECT so.[name] as

    , CASE WHEN si.indid between 1 and 254

    THEN si.[name] ELSE NULL END

    AS [Index Name]

    , si.indid, rows

    FROM sys.sysindexes si

    INNER JOIN sysobjects so

    ON si.id = so.id

    WHERE si.indid < 2

    AND so.type = 'U' -- Only User Tables

    AND so.[name] != 'dtproperties'

    ORDER BY so.[name]

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!