Home > database >  Whether have ordered take out the line count value for the table properties?
Whether have ordered take out the line count value for the table properties?

Time:04-22

Usually need when used to record the total number of article in the count (*), but the query speed is slow, with the right mouse button point today open a table properties page and store labels issued by existing off-the-shelf line count value, on the spot and the count (*) contrast, the number is the same, I'd like to know if you could use the SQL command line from the count value, because I can not open the table attribute almost time consuming, if this value is recorded in a certain place, can take out?

CodePudding user response:

 
The select a.n ame, b.r ows
The from sysobjects a inner join sysindexes b on Anderson, d=b.i d
Where xtype='U' and b.i ndid in (0, 1)
The order by b.r ows desc


Choose your database, execute the script, it is,

CodePudding user response:

 replace our table name 
The EXEC sp_spaceused 'tableName'


CodePudding user response:

 
Select the table name=a.n ame,
Line count=b.r ows
The from sys. Tables a
The join (select object_id,
Rows=sum (rows)
The from sys. Partitions
Group by object_id) b on a.o bject_id=b.o bject_id
Where a.n ame=N 'table'
  • Related