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
Get Table Name with Maximum Rows
Pankaj Kumar Choudhary
Aug 09
2016
Code
549
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
WITH
CTE
AS
(
SELECT
OBJECT_NAME(OBJECT_ID) Table_Name, ps.row_count
AS
Total_Rows
FROM
sys.dm_db_partition_stats ps
WHERE
index_id < 2
)
SELECT
TOP
1
WITH
TIES *
FROM
CTE
ORDER
BY
CTE.Total_Rows
DESC
SQL Server