All Forums Database
usmans 39 posts Joined 01/13
10 Sep 2013
Get Row Count of a Table on a previous date

Hi All,
We keep 3 months of historic data. Is it possible to get the row count of a table on any previous date?
The date might be 1,2 or 3 months old.
I can get the size of the table but is there any method to get row count?

--Regards Usmans
Qaisar Kiani 337 posts Joined 11/05
11 Sep 2013

I don't think that is possible unless you have some metadata capturing process defined capturing table details before and after execution of the loading jobs...

Adharssh 36 posts Joined 08/13
11 Sep 2013

You can get the row count only when you have an Timsewtamp column,which will be updated when you insert or update the record in the table. So that we can get the row count using the Timestamp variable from the Table.

Share the Knowledge. Feel the Happiness, When you share/Teach it.

usmans 39 posts Joined 01/13
15 Sep 2013

Thanks for the replies folks.
We have a housekeeping job that keeps a record of all the sizes of tables as well as databases, but only 90 days old.


Qaisar Kiani 337 posts Joined 11/05
16 Sep 2013

You can calculate the size of row using the data types used in table definition and probably can do some maths to calculate the number of rows using currentperm consumed against the rowsize. You can probably get close to the number of rows but I am not sure how accurate those results would be.....

You must sign in to leave a comment.