关键代码如下所示: DECLARE @tb1 Table( drive varchar(20), [MB 可用空间] varchar(20)) INSERT INTO @tb1 Exec master.dbo.xp_fixeddrivesselect drive , CAST( CAST((CAST([MB 可用空间] as decimal(9,2))/1024 ) as decimal(9,2)) as v
关键代码如下所示:
DECLARE @tb1 Table
(
drive varchar(20),
[MB 可用空间] varchar(20)
)
INSERT INTO @tb1
Exec master.dbo.xp_fixeddrives
select drive , CAST( CAST((CAST([MB 可用空间] as decimal(9,2))/1024 ) as decimal(9,2)) as varchar)+'G' as 剩余空间 from @tb1
以上所述是SQL查询服务器硬盘剩余空间,希望对大家有所帮助,如果大家想了解更多内容敬请关注每日运维!