Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mssql show database size

SELECT 
      database_name = DB_NAME(database_id)
    , log_size_mb = CAST(SUM(CASE WHEN type_desc = 'LOG' THEN size END) * 8. / 1024 AS DECIMAL(8,2))
    , row_size_mb = CAST(SUM(CASE WHEN type_desc = 'ROWS' THEN size END) * 8. / 1024 AS DECIMAL(8,2))
    , total_size_mb = CAST(SUM(size) * 8. / 1024 AS DECIMAL(8,2))
FROM sys.master_files WITH(NOWAIT)
WHERE database_id = DB_ID() -- for current db 
GROUP BY database_id
Comment

PREVIOUS NEXT
Code Example
Sql :: how to check last gather stats on table in oracle 
Sql :: list mysql users 
Sql :: oracle user last connection date 
Sql :: check if mysql is installed 
Sql :: get hour from date sql 
Sql :: rename table postgres 
Sql :: oracle list dblink 
Sql :: ubuntu stop mysql from starting on boot 
Sql :: sqlite connection string 
Sql :: mysql slave status 
Sql :: oracle compile whole schema 
Sql :: mysql 8 error on identified by 
Sql :: how to import database in mysql by cmd 
Sql :: sql pick random row 
Sql :: grab all records from one table to another oracle sql 
Sql :: how to check database engine in mysql 
Sql :: node and mysql like 
Sql :: show table status command in mysql 
Sql :: how to give access to database in postgresql server to another user 
Sql :: oracle sql assign unique number to each grouping 
Sql :: sql current timestamp 
Sql :: foreign key oracle 
Sql :: operator does not exist: integer = text 
Sql :: mysql disable foreign keys check 
Sql :: describe sql server 
Sql :: get parameter value in mysql trigger 
Sql :: sql random decimal 
Sql :: mysql delete all where id is not equal 
Sql :: delete table sql 
Sql :: Columns Present in a table 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =