January 27, 2020 at 4:55 pm
We have 30 K tables in DB and I have a table which checks the table growth of each table on Daily basis. Application do create new table.
I want to know if any new table created with his size. Can someone please help me with Query?
SELECT
[TBL_name]
,[TBL_rows]
,[TBL_space]
,[TBL_date]
From Table_Growth
January 27, 2020 at 5:12 pm
I think the following would give you the result you need:
SELECT
[TBL_name]
,[TBL_rows]
,[TBL_space]
,[TBL_date]
From Table_Growth
where datediff(d,[TBL_date],getdate())=1
January 27, 2020 at 5:37 pm
I am getting the list of all the table with above query.
I basically want to know the list of new table created in last 5 days as compare to table I have in my table.
I have 30K tables and lets say extra 5 table created in last 5 days I want to know with the table name and its size
January 27, 2020 at 5:53 pm
I think I misunderstood your first post. Does the table contain:
a) One row for each table and the date is the last time it was updated or
b) One row for each table for each date?
January 27, 2020 at 6:20 pm
Table has been insert one row for each table for each date
January 27, 2020 at 6:53 pm
I think the following might give you the result you need?:
select [tbl_name], [tbl_space] from table_growth tg where
not exists (select 1 from table_growth tg1 where tg.tbl_name=tg1.[tbl_name] and datediff(d,[tbl_date],getdate())>=5)
January 27, 2020 at 8:16 pm
Thanks a lot yes this worked as I expected
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply