Skip to content

Commit b82a318

Browse files
BrentOzarclaude
andcommitted
sp_Blitz: address PR review feedback
Three fixes from the PR review: 1. Pass @suppress_quotename = 1 to every sp_ineachdb call. sp_ineachdb's default quotes the replacement (QUOTENAME'd [mydb]), which combined with sp_Blitz's sp_MSforeachdb-style USE [?] and [?].schema.object patterns would produce malformed identifiers like USE [[mydb]] on box SQL. @suppress_quotename = 1 substitutes the bare name and matches sp_MSforeachdb's behavior exactly. 2. README note that sp_Blitz now requires sp_ineachdb, with install ordering guidance for users installing scripts individually. 3. Build Installation Scripts.ps1 now places sp_ineachdb.sql ahead of sp_Blitz in the generated Install-All-Scripts.sql, so the dependency is installed before any proc that calls it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fd850b5 commit b82a318

3 files changed

Lines changed: 54 additions & 44 deletions

File tree

Documentation/Development/Build Installation Scripts.ps1

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,17 @@ if (Test-Path $BlitzFirstPath) {
151151
Write-Host " Built: Install-Azure.sql"
152152

153153
# ── Install-All-Scripts.sql ──────────────────────────────────────────────────
154-
# All sp_*.sql except sp_BlitzInMemoryOLTP.sql and sp_BlitzFirst.sql
155-
$allContent = Get-ChildItem -Path $RepoRoot -Filter "sp_*.sql" |
156-
Where-Object { $_.Name -notlike "*BlitzInMemoryOLTP*" -and $_.Name -notlike "*BlitzFirst*" } |
154+
# All sp_*.sql except sp_BlitzInMemoryOLTP.sql and sp_BlitzFirst.sql.
155+
# sp_ineachdb.sql must come first because sp_Blitz (and others) call it at
156+
# runtime — putting it ahead of sp_Blitz means the dependency exists by the
157+
# time later procs execute per-database checks.
158+
$IneachdbPath = Join-Path $RepoRoot "sp_ineachdb.sql"
159+
$allContent = @()
160+
if (Test-Path $IneachdbPath) {
161+
$allContent += Get-Content -Path $IneachdbPath -Raw -Encoding UTF8
162+
}
163+
$allContent += Get-ChildItem -Path $RepoRoot -Filter "sp_*.sql" |
164+
Where-Object { $_.Name -notlike "*BlitzInMemoryOLTP*" -and $_.Name -notlike "*BlitzFirst*" -and $_.Name -ne "sp_ineachdb.sql" } |
157165
ForEach-Object { Get-Content $_.FullName -Raw -Encoding UTF8 }
158166

159167
# Append SqlServerVersions.sql

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ When you have a question about what the scripts found, first make sure you read
7676
## sp_Blitz: Overall Health Check
7777
Run sp_Blitz daily or weekly for an overall health check. Just run it from SQL Server Management Studio, and you'll get a prioritized list of issues on your server right now.
7878

79+
**Note:** sp_Blitz requires `sp_ineachdb` (also shipped in this repo) to be installed in the same database. `Install-All-Scripts.sql` installs both automatically, with `sp_ineachdb` placed first. If you're installing scripts individually, install `sp_ineachdb.sql` before `sp_Blitz.sql`, or sp_Blitz will fail at runtime on its per-database checks. See the [sp_ineachdb section](#sp_ineachdb-run-a-command-in-each-database) below for details.
80+
7981
Output columns include:
8082

8183
* Priority - 1 is the most urgent, stuff that could get you fired. The warnings get progressively less urgent.

0 commit comments

Comments
 (0)