File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -450,16 +450,16 @@ function Get-DbaDatabase {
450450 # Azure SQL Database doesn't have sys.master_files
451451 # Use sys.database_files which is database-scoped
452452 " SELECT DB_NAME() AS name,
453- CAST(SUM(size) * 8.0 / 1024 AS DECIMAL(18,2)) AS SizeMB
453+ CAST(SUM(CAST( size AS BIGINT) ) * 8.0 / 1024 AS DECIMAL(18,2)) AS SizeMB
454454 FROM sys.database_files"
455455 } elseif ($server.VersionMajor -ge 9 ) {
456456 " SELECT DB_NAME(database_id) AS name,
457- CAST(SUM(size) * 8.0 / 1024 AS DECIMAL(18,2)) AS SizeMB
457+ CAST(SUM(CAST( size AS BIGINT) ) * 8.0 / 1024 AS DECIMAL(18,2)) AS SizeMB
458458 FROM sys.master_files
459459 GROUP BY database_id"
460460 } else {
461461 " SELECT dbname = DB_NAME(dbid),
462- SizeMB = CAST(SUM(size) * 8.0 / 1024 AS DECIMAL(18,2))
462+ SizeMB = CAST(SUM(CAST( size AS BIGINT) ) * 8.0 / 1024 AS DECIMAL(18,2))
463463 FROM master.dbo.sysaltfiles
464464 GROUP BY dbid"
465465 }
You can’t perform that action at this time.
0 commit comments