MSSQL 如何用脚本查询服务器所有数据库在硬盘上存储的地址?
------解决思路----------------------
sp_msforeachdb 'select * from sys.database_files'
------解决思路----------------------
SELECT DB_NAME(database_id) DBName ,
name [FILENAME] ,
physical_name ,
type_desc ,
CAST(size AS VARCHAR(10)) + 'MB' AS currentsize ,
CASE WHEN max_size = -1 THEN 'unlimited'
ELSE CONVERT(VARCHAR(20), max_size / 1024)
END [LimitSIZE(MB)] ,
CASE WHEN is_percent_growth = 0
THEN CAST(growth AS VARCHAR(10)) + 'MB'
ELSE CAST(growth AS VARCHAR(10)) + '%'
END [GrowTH]
FROM sys.master_files