SQL Server - How to Count Number of Rows and Columns in a table with Query?
sql server - To get total number of columns in a table in sql
Count Number of Rows in a Table
There are following ways to find number of rows from a table. Find the queries below :
Query 1
select
[TotalCount]=rows from sysindexes where indid <=1 and ID=object_ID('clients')
Query 2
SELECT SUM(rows) FROM sys.partitions WHERE object_id
= OBJECT_ID(N'dbo.clients')
AND index_id IN(0,1)
Count Number of Columns from a Table
There are following ways to finf number of column from a table. Find the queries below :
Query 1
select count(*) from Employee.information_schema.columns where
table_name = 'Employee'
Query 2
select count(*),table_name
from information_schema.COLUMNS
GROUP BY table_name
SQL Server - How to Count Number of Rows and Columns in a table with Query?
Reviewed by Ravi Kumar
on
5:15 PM
Rating:

No comments: