Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does Properties work?
Message
 
 
To
04/12/2006 09:15:21
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00838308
Message ID:
01456334
Views:
60
Please see this link for fast row count in SQL Server

http://sqlblogcasts.com/blogs/simons/archive/2010/01/14/Quickest-way-to-get-the-row-count-of-a-table.aspx

>Thanks Sergey,
>
>thought I was going crazy!
>
>>>I have an SQL 2000 table that the Properties shows 1990 rows, but in the Open all it appears to have 2000 and if I use a Foxpro remote view, it shows 2000 records.
>>>
>>Hi Joel,
>>
>>There're two ways to get total records count in SQL Server table:
>>1. SELECT COUNT(*) FROM mytable
>>Produces correct count but may take long on tables with a lot of records.
>>
>>2. SELECT rowcnt FROM sysindexes WHERE id=OBJECT_ID('dbo.mytable') and indid < 2
>>Fast but result isn't relaible because it's based on data stored in sysindexes tables which may or may not be current.
>>
>>Most likely SQL Server uses the second method because it's much faster on big tables.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform