I have a database and there is not any trigger which follows the transactions in said database.
Now, I have to make a report that shows which table has mostly inserted so far. How can I do that?
I have a database and there is not any trigger which follows the transactions in said database.
Now, I have to make a report that shows which table has mostly inserted so far. How can I do that?
To know mostly inserted table you can simply retrieve number of rows/records in the table.
You can use following query to find it. Mostly inserted tables will be displayed on top of the records.
SELECT
o.Name TableName,SUM(ps.row_count) Total_Rows
FROM
sys.dm_db_partition_stats ps
inner join sys.objects o
on ps.object_id=o.object_id
WHERE o.type='U'
GROUP BY
o.Name
ORDER BY 2 DESC
Edit:1
As you described you requirement in comments, "you need find mostly inserted tables between a date range. It can be done using several method.
Thanks!