This is the forth article in the transaction and lock series. Up to now, the locks and hints discussed have applied to both SQL 2000 and SQL 20005. However, this article will introduce Snapshots, new in Microsoft SQL 2005.
I found it interesting to sometimes know how many records there are in my databases. This coding will allow you to count all of the records contained within any single user database you have created. It is very simple to switch databases to count (1 line of coding need be modified). You can also sort the results by either the record count or the table name.
This coding is a modification of a post I had found that would display all of the tables and their record counts. I found the original posting to also include other tables that may not hold as much relevance such as system tables, etc. You can view the original posting at: http://www.sqlservercentral.com/scripts/Miscellaneous/30324/
I have attempted to make it clear as to what is the original coding and what I had added, and what additional options you could look to use with this coding.