get the count of rows all tables based on created date (Month or year ) in SQL Server

ramazan orhan 20 Reputation points
2024-10-23T20:12:21.0466667+00:00

how can find the count of rows all tables based on created date (Month or year ) in SQL Server

SQL Server Other
{count} votes

Accepted answer
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2024-10-23T21:18:29.8366667+00:00

    Your question is not very clear.

    But if the question is: How can I get a count of rows added to each table per month of year, the answer is that you can't in the general case, since this is nothing that SQL Server tracks out of the box.

    But it is not uncommon when you design tables, that you have an auditing column named CreateTime or something of the kind that defaults to sysdatetime() or getdate() and which never changes. So if your tables have such a column, you can get this information this way.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.