SQL Server Performance

Which system table give results of COUNT(*)?

Discussion in 'General Developer Questions' started by sonnysingh, Aug 11, 2006.

  1. sonnysingh Member

    Hi all

    please could any one can tell that which system table have could get the results as function COUNT(*). I mean if do not want to use COUNT(*) rather this column(s) from system table to produce same as COUNT(*) funcction.

    Thanks...
  2. FrankKalis Moderator

    sysindexes. But it is not guaranteed to be correct all the time

    --
    Frank Kalis
    Moderator
    Microsoft SQL Server MVP
    Webmaster:http://www.insidesql.de
  3. patel_mayur New Member

    AFAIK...

    Select Object_Name(id) AS ObjectName, rowcnt AS RowCnt
    From Sysindexes Where Object_Name(id) = 'TableName'
  4. Roji. P. Thomas New Member

  5. ramkumar.mu New Member

    DBCC UPDATEUSAGE (0)

    This would guarantee the rowcount is up-to-date... and then use this statement

    SELECT object_name(id) [TableName]
    ,rowcnt [Rows]
    FROM sysindexes
    WHERE object_name(id) IN (SELECT Name
    FROM sysobjects
    WHERE type = 'u')
    AND IndID IN (0,1)
    ORDER BY object_name(id)



    Thanks,
    Ram

    "It is easy to write code for a spec and walk in water, provided, both are freezed..."

Share This Page