Row count in SQL Server

[expired user #9528]'s profile image [expired user #9528] posted 8 years ago in General Permalink

Version 9.3.0.4984

When in the database view where all of the objects (tables, functions, procedures, etc.) are listed, there is a column called Rows. I assume this is for displaying the number of rows in that table. If not, how can I view the number of rows without having do a SELECT COUNT(*) from 'TABLE'?

kalvaro's profile image kalvaro posted 8 years ago Permalink

MySQL (the DBMS that HeidiSQL was originally written for) maintains a row count that can be queried together with table information at constant cost. I don't think SQL Server provides a similar feature (if it does, though, I shouldn't be a great deal to display it.)

[expired user #9528]'s profile image [expired user #9528] posted 8 years ago Permalink

Thank you for your reply! I am not sure if its built into SQL Server but its a feature that is used in another program like HeidiSQL. I think it would be an awesome option. I am always constantly monitoring row counts especially when running jobs that populate tables.

[expired user #11321]'s profile image [expired user #11321] posted 6 years ago Permalink

Dear HeidiSQL Enthusiasts and Developers

Row count in MS SQL Server does not work at all.

Can you please include the following proper query for MS SQL that will work with any MS SQL Server:

SELECT 
    OBJECT_SCHEMA_NAME(p.object_id) AS [Schema]
    ,OBJECT_NAME(p.object_id) AS [Table]
    ,sum(p.rows)    AS [Row Count]
FROM sys.partitions p
WHERE 1=1
    and p.index_id in (0,1) /*take heap or clustered index, they are mutually exclusive */
    and OBJECT_NAME(p.object_id) = @tableNameInHeidiSQLList
GROUP BY OBJECT_SCHEMA_NAME(p.object_id)
        ,OBJECT_NAME(p.object_id)

Would be easier if there were a separate settings file containing the SQL queries that HeidiSQL uses for row counts, object lists etc. Then I would be able to adjust the row count query.

Please let me know if you can add this query to HeidiSQL.

ab-tools's profile image ab-tools posted 5 years ago Permalink

Hello,

looks like that also 4 years later there is still no rows count information when connected to Microsoft SQL Server.

Is there a chance that this will be fixed soon?

Best regards and thanks Andreas

Please login to leave a reply, or register at first.