I am trying to get the actually size of records based on the date which they where created. i used a count to get the number of rows in the table then multiply the result by the top average byte. I have created a table that stores the results. I tried to sum the results of the size that are stored in the results tables but the values did not compare to the actually size of the table. is it possible to use the rows to get the actually size of the table based on the date the rows where created. e.g i wanted to calculate the size of the rows that where created between the 1st of November to the end of November. I want to do this for all tables within the database. I am using Microsoft (SQL Server) Management Studio 2016
DECLARE @numbrowsJ int; DECLARE @byteNumberJ decimal (18,5); Declare @tableName varchar(100); -- DECLARE @Dbname varchar(100); Declare @year int; set @Dbname = 'Test'; SET @year = 2017; set @tableName = 'ProductRequest' set @byteNumberJ = (select TOP 1 avg_record_size_in_bytes FROM sys.dm_db_index_physical_stats (DB_ID(@Dbname), OBJECT_ID(@tableName), NULL, NULL , 'DETAILED')); select @byteNumberJ --set to insert into table then from there Insert Sizing( month, SizeinMb, RowCounts, year, TableName,DatabaseName) SELECT DATENAME(mm,request_date) MONTH, COUNT(*) * @byteNumberJ /1024 As SizeinMB, count (*) RowCounts , DATENAME (yyyy,request_date) As 'Year', @tableName as 'TableName', @Dbname FROM ProductRequest where YEAR(request_date) = @year Group BY DATENAME(mm,request_date), DATENAME (yyyy,request_date)
— The above basically inserts the calculation into a table when ever i do a sum using the query below does a summation of the calculated size.
-- see attached link query result for answer. SELECT Sum(RowCounts) as TotalRowCounts ,[DatabaseName] ,sum (SizeinMb) /1024 As CurrentSizeMB FROM Sizing where year = 2017 and DatabaseName ='databasenamegoe' and TableName = 'ProductRequest' Group by DatabaseName
Query Result How do i get the size to add up to the same value if i was to right click on the table name and select storage as shown below.
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!