๐ฉโ๐ป ๆฅ่ฉขๅ ็จ็กฌ็ข
-- ๆชข่ฆ็ฎๅ่ณๆๅบซๆ็จ็็ฉบ้๏ผไฝไธไธๅฎ่ฝๅๆ ๅฏฆ้ๅฏ็จ็็ฃ็ข็ฉบ้ใ
EXEC sp_spaceused
GO
-- ่ฆๆฑๆๆ่ณๆๅบซไธญ็ๅ
จ้จ็่ณๆ้ ๅพ๏ผๅๆชข่ฆ็ฎๅ่ณๆๅบซๆ็จ็็ฉบ้
EXEC sp_spaceused @updateusage = N'TRUE';
GO
SET NOCOUNT ON
DECLARE @tDBSize TABLE
(DBName SYSNAME DEFAULT(DB_NAME()),
Fileid INT, FileGroup INT, TotalExtents INT,
UsedExtents INT, Name SYSNAME, FileName NVARCHAR(4000))
INSERT @tDBSize(Fileid,FileGroup,TotalExtents,UsedExtents,Name,FileName)
EXEC ('DBCC showfilestats')
SELECT DBName N'่ณๆๅบซ',Name N'่ณๆๆชๆก',
TotalExtents*64.0/1024 N'่ณๆๆชๆกไฝฟ็จ็กฌ็ข็ฉบ้(MB)',
UsedExtents*64.0/1024 N'่ณๆๅฏฆ้ไฝฟ็จ็ฉบ้(MB)', FileName N'ๅฏฆ้ซๆชๆก่ทฏๅพ'
FROM @tDBSize
GO