Consider our company is working on some audit process and they want to log the table names with record count in Audit table during different hours of the day OR we are planning for storage and want to know which table has the most records and plan the storage accordingly.
The below query will return us all the tables from SQL Server Database with record count. We will be using System tables sysindexes and sys.tables to get our record count with table names.
SELECT DISTINCT t.name AS TableName,
i.rows AS RecordCnt
FROM sysindexes i
INNER JOIN sys.tables t
ON i.id = t.OBJECT_ID
WHERE t.is_ms_shipped = 0
ORDER BY t.name
The below query will return us all the tables from SQL Server Database with record count. We will be using System tables sysindexes and sys.tables to get our record count with table names.
SELECT DISTINCT t.name AS TableName,
i.rows AS RecordCnt
FROM sysindexes i
INNER JOIN sys.tables t
ON i.id = t.OBJECT_ID
WHERE t.is_ms_shipped = 0
ORDER BY t.name
Fig 1: Get Record Count with Table Names from SQL Server Database
Video Demo: How to Get Record Count for all the tables on SQL Server Instance
thanks sir..
ReplyDeleteDo you want to improve the performance of your business? Of course you do! Maybe you're unsure where to start, or how to go about it. This checklist of questions will give you a good overview of your business's strengths, weaknesses and areas that need improvement. You may find some of them tough - or a little confronting - but be honest! The path to improving your business performance starts today. account bookkeeping
ReplyDeleteDatabase management is a crucial aspect of any well-structured system. Whether it’s for analytics or entertainment platforms, having optimized data handling ensures a seamless experience. Recently, I came across baji apps, and I was impressed by the level of detail and smooth functionality. Just like efficient database design, a good app needs to be intuitive and well-structured for the best user experience. It’s always fascinating to see how technology drives improvements in various industries, from gaming to data management. Excited to learn more from this community and share insights on tech innovations!
ReplyDeleteFinding a reliable betting app for Android can be a challenge, but the paripesa app download for android makes everything simple and accessible. With a smooth interface and a variety of betting options, it provides everything a player needs for an enjoyable experience. Whether you’re into live sports betting or classic casino games, this app ensures a seamless transition between different activities. The best part? It’s optimized for Android devices, so you don’t have to worry about glitches or performance issues. Betting should be fun and hassle-free, and this app delivers exactly that!
ReplyDelete