May 20, 2009 at 12:27 am
how to get the count of rows in a table...urgent
May 20, 2009 at 12:35 am
SELECT COUNT(*) FROM TABLE
Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
May 20, 2009 at 12:39 am
refer the COUNT function
http://msdn.microsoft.com/en-us/library/ms175997.aspx
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
May 20, 2009 at 1:54 am
thanks
May 21, 2009 at 9:31 am
Even you can go with any column which are having distinct values.
select count(column name) from table name.
May 21, 2009 at 6:16 pm
... or find all rows in all tables - code borrowed from many sources inc. James DBA!
use MyDatabase
SELECT o.name AS [TableName], i.rowcnt AS [RowCount]
-- into master..tblDBHrows_20090522 -- this will allow saving the result
FROM sysobjects o, sysindexes i
WHERE i.id = o.id
AND indid IN (0,1)
--This specifies 'user' databases only
AND xtype = 'u' --Added by James_DBA
--This omits the diagrams table of the database
--You may find other system tables will need to be ommitted,
--you would just name them all here using the operator
--i.e. o.name dtproperties, o.name 'sysdiagrams'
AND o.name 'sysdiagrams' --Added by James-DBA
--You could also look further into filtering out temp tables,
--or user specified tables
ORDER BY o.Name -- or by size as you prefer
May 21, 2009 at 8:48 pm
shanila_minnu (5/20/2009)
how to get the count of rows in a table...urgent
Interview? 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply