Skip to content

Commit ae9778c

Browse files
BrentOzarclaude
andcommitted
sp_Blitz: use @IsAzureSQLDB variable instead of re-checking SERVERPROPERTY
Addresses Copilot review feedback on BrentOzarULTD#3951: the Azure SQL DB skip block and the CheckID 232 sys.master_files fallback both already had @IsAzureSQLDB set upstream, so they should use the cached variable rather than calling SERVERPROPERTY('EngineEdition') again inline. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0cc01d9 commit ae9778c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sp_Blitz.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ BEGIN
928928
END; /* Azure Managed Instance skipped checks */
929929

930930
/* If the server is Azure SQL Database, skip checks that it doesn't allow */
931-
IF SERVERPROPERTY('EngineEdition') = 5
931+
IF @IsAzureSQLDB = 1
932932
BEGIN
933933
/* Backup / restore history - msdb does not exist on Azure SQL DB */
934934
INSERT INTO #SkipChecks (CheckID) VALUES (1); /* Full backups */
@@ -9933,7 +9933,7 @@ IF NOT EXISTS ( SELECT 1
99339933
DROP TABLE IF EXISTS #MasterFiles;
99349934
CREATE TABLE #MasterFiles (database_id INT, file_id INT, type_desc NVARCHAR(50), name NVARCHAR(255), physical_name NVARCHAR(255), size BIGINT);
99359935
/* Azure SQL Database doesn't have sys.master_files, so we have to build our own. */
9936-
IF (CONVERT(INT, SERVERPROPERTY('EngineEdition')) = 5
9936+
IF (@IsAzureSQLDB = 1
99379937
AND (OBJECT_ID('sys.master_files') IS NULL))
99389938
SET @StringToExecute = 'INSERT INTO #MasterFiles (database_id, file_id, type_desc, name, physical_name, size) SELECT DB_ID(), file_id, type_desc, name, physical_name, size FROM sys.database_files;';
99399939
ELSE

0 commit comments

Comments
 (0)