Skip to content

Commit

Permalink
Get-DbaDbStoredProcedure: Moved Test-Bound -ParameterName ExcludeSyst…
Browse files Browse the repository at this point in the history
…emSp outside of nested loop (#9419)
  • Loading branch information
ReeceGoding authored Jul 16, 2024
1 parent b36ae22 commit 8bc9dfb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions public/Get-DbaDbStoredProcedure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ function Get-DbaDbStoredProcedure {
$InputObject = Get-DbaDatabase -SqlInstance $SqlInstance -SqlCredential $SqlCredential -Database $Database -ExcludeDatabase $ExcludeDatabase
}

$ExcludeSystemSpIsBound = Test-Bound -ParameterName ExcludeSystemSp

foreach ($db in $InputObject) {
if (!$db.IsAccessible) {
Write-Message -Level Warning -Message "Database $db is not accessible. Skipping."
Expand Down Expand Up @@ -182,7 +184,7 @@ function Get-DbaDbStoredProcedure {
}

foreach ($proc in $procs) {
if ( (Test-Bound -ParameterName ExcludeSystemSp) -and $proc.IsSystemObject ) {
if ($ExcludeSystemSpIsBound -and $proc.IsSystemObject ) {
continue
}

Expand All @@ -198,4 +200,4 @@ function Get-DbaDbStoredProcedure {
}
}
}
}
}

0 comments on commit 8bc9dfb

Please sign in to comment.