Temporary Tables And Their Size SQL

SELECT TBL.name AS ObjName

      ,STAT.row_count AS StatRowCount

      ,STAT.used_page_count * 8 AS UsedSizeKB

      ,STAT.reserved_page_count * 8 AS RevervedSizeKB

FROM tempdb.sys.partitions AS PART

     INNER JOIN tempdb.sys.dm_db_partition_stats AS STAT

         ON PART.partition_id = STAT.partition_id

            AND PART.partition_number = STAT.partition_number

     INNER JOIN tempdb.sys.tables AS TBL

         ON STAT.object_id = TBL.object_id

ORDER BY TBL.name;

 

 

Comments

  1. Great article, Thank you for sharing this valuable info with us.

    ReplyDelete

Post a Comment

Hi User,
Thanks for visiting My Blog and please provide your valuable feedback and subscribe for more updates. Please don't post any spam content or comments.
Thank You

Popular Posts

Failed to execute the package or element. Build errors were encountered

Restore of database 'DataBase_Name' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks)

Cannot convert "Column" between a unicode and a non-unicode string data types in SSIS