sqlserver 查询数据库大小的方法
程序员文章站
2023-12-13 15:38:22
但insus.net想到的是,从下面的sql语句,就可以查询到数据库大小。因此分享于此。 复制代码 代码如下: select db_name(database_id) as...
但insus.net想到的是,从下面的sql语句,就可以查询到数据库大小。因此分享于此。
select db_name(database_id) as [database name],[name] as [logical name],[physical_name] as [physical name],((size * 8) / 1024) as [size(mb)],[differential_base_time] as [differential base time]
from sys.master_files
where db_name(database_id) in('xxx')
go
复制代码 代码如下:
select db_name(database_id) as [database name],[name] as [logical name],[physical_name] as [physical name],((size * 8) / 1024) as [size(mb)],[differential_base_time] as [differential base time]
from sys.master_files
where db_name(database_id) in('xxx')
go