How to catch the output of a DBCC-Statement in a temptable

前端 未结 2 610
别那么骄傲
别那么骄傲 2020-12-15 18:19

I tried the following on SQL-Server:

create table #TmpLOGSPACE(
  DatabaseName varchar(100)
  , LOGSIZE_MB decimal(18, 9)
  , LOGSPACE_USED decimal(18, 9)
           


        
2条回答
  •  北海茫月
    2020-12-15 18:57

    Put the statement to be run inside EXEC('')

    insert #TmpLOGSPACE(DatabaseName, LOGSIZE_MB, LOGSPACE_USED, LOGSTATUS) 
    EXEC('DBCC SQLPERF(LOGSPACE);')
    

提交回复
热议问题