Check Table Size and DB Size

  • Comments posted to this topic are about the item Check Table Size and DB Size

    Br. Kenneth Igiri
    https://kennethigiri.com
    All nations come to my light, all kings to the brightness of my rising

  • While running the code to check the table size, I got this error:

    'Msg 15009, Level 16, State 1, Procedure sp_spaceused, Line 62

    The object '[dbo].[#0035E158]' does not exist in database 'tempdb' or is invalid for this operation.

  • Which of th scripts did you have this error with? Check DB Size or CHeck Table Size.

    Br. Kenneth Igiri
    https://kennethigiri.com
    All nations come to my light, all kings to the brightness of my rising

  • Apparently yo had this error with the Check table Size script:

    use AcsData

    go

    create table #tablesize

    (name nvarchar(120),rows char(11),reserved varchar(18),

    data varchar(18),index_size varchar(18),unused varchar(18))

    go

    insert into #tablesize

    exec

    sp_msforeachtable @command1=

    'exec sp_spaceused ''?'''

    select * from #tablesize

    go

    drop table #tablesize

    go

    You need to replace the <DB_NAME> line with an actual database. Apparently you ran the script on tempdb and objects are created and droped in this db onthe fly.

    Br. Kenneth Igiri
    https://kennethigiri.com
    All nations come to my light, all kings to the brightness of my rising

  • It works now. Thank you

  • Thanks for the script.

  • ...and the update.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply