MSSQL
Microsoft SQL Server
Table Size in Microsoft SQL Server
Submitted by TimBruce on Wed, 2010-01-27 13:02Sometimes I want to find out how many rows are in each user table in a database. The following SQL helps me determine this.
select 'SELECT COUNT(*) AS ' +
'''' +
RTRIM ( name ) +
'''' +
' FROM ' +
RTRIM ( name )
from sysobjects where type = 'U'
order by name
SQL Server Version
Submitted by TimBruce on Thu, 2008-09-04 20:32There are a variety of ways to determine which version of SQL Server you are running. While the @@version information will tell you the current version
SELECT @@version
SELECT LTRIM(RIGHT(LEFT(@@VERSION,38),9))
The following code will as well, and in a slightly different format:
SELECT 'SQL Server '
