mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Adding SQL tools team recommendations (#21866)
This commit is contained in:
@@ -44,12 +44,15 @@ const query_target_databases_sql = `
|
|||||||
AND is_distributor <> 1
|
AND is_distributor <> 1
|
||||||
ORDER BY db.name;`;
|
ORDER BY db.name;`;
|
||||||
|
|
||||||
|
// NOTES: Converting the size to BIGINT is need to handle the large database scenarios.
|
||||||
|
// Size column in sys.master_files represents the number of pages and each page is 8 KB
|
||||||
|
// The end result is size in MB, 8/1024 = 1/128.
|
||||||
const query_databases_with_size = `
|
const query_databases_with_size = `
|
||||||
WITH
|
WITH
|
||||||
db_size
|
db_size
|
||||||
AS
|
AS
|
||||||
(
|
(
|
||||||
SELECT database_id, CAST(SUM(size) / 128 AS bigint) size
|
SELECT database_id, CAST(SUM(CAST(size as BIGINT)) / 128 AS BIGINT) size
|
||||||
FROM sys.master_files with (nolock)
|
FROM sys.master_files with (nolock)
|
||||||
GROUP BY database_id
|
GROUP BY database_id
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user