TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Reterving all Tables Names and Row Count in SQL
Karthik Puppala
Sep 15
2014
Code
1.4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
SELECT
sc.
name
+
'.'
+ ta.
name
TableName,
SUM
(pa.
rows
) RowCnt
FROM
sys.tables ta
INNER
JOIN
sys.partitions pa
ON
pa.OBJECT_ID = ta.OBJECT_ID
INNER
JOIN
sys.schemas sc
ON
ta.schema_id = sc.schema_id
WHERE
ta.is_ms_shipped = 0
AND
pa.index_id
IN
(1,0)
GROUP
BY
sc.
name
,ta.
name
ORDER
BY
SUM
(pa.
rows
)
desc
Reterv all Tables Name in SQL
Row Count in SQL
code for Reterving all Tables Names and Row Count in SQL