Skip to content

Commit

Permalink
Merge pull request #82 from VladDBA/dev
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
VladDBA authored May 7, 2023
2 parents 344f015 + f9e5619 commit 90eff55
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions PSBlitz.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ param(

###Internal params
#Version
$Vers = "3.1.0"
$VersDate = "20230507"
$Vers = "3.1.1"
$VersDate = "20230508"
#Get script path
$ScriptPath = split-path -parent $MyInvocation.MyCommand.Definition
#Set resources path
Expand Down Expand Up @@ -631,8 +631,10 @@ if ($ConnCheckSet.Tables[0].Rows.Count -eq 1) {
if (!([string]::IsNullOrEmpty($CheckDB))) {
Write-Host "Checking existence of database $CheckDB..."
$CheckDBQuery = new-object System.Data.SqlClient.SqlCommand
$DBQuery = "SELECT [name] from sys.databases WHERE [name] = '$CheckDB' AND [state] = 0;"
$DBQuery = "SELECT [name] from sys.databases WHERE [name] = @DBName AND [state] = 0;"
$CheckDBQuery.CommandText = $DBQuery
$CheckDBQuery.Parameters.Add("@DBName", [Data.SQLDBType]::NVarChar, 256) | Out-Null
$CheckDBQuery.Parameters["@DBName"].Value = $CheckDB
$CheckDBQuery.Connection = $SqlConnection
$CheckDBQuery.CommandTimeout = 100
$CheckDBAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
Expand All @@ -647,7 +649,7 @@ if (!([string]::IsNullOrEmpty($CheckDB))) {
}
}
Catch {
Write-Host "Database $CheckDB either does not exist or is offline" -fore red
Write-Host "->Database $CheckDB either does not exist or is offline" -fore red
$InstanceWide = Read-Host -Prompt "Switch to instance-wide plan cache, index, and deadlock check?[Y/N]"
if ($InstanceWide -eq "Y") {
$CheckDB = ""
Expand Down

0 comments on commit 90eff55

Please sign in to comment.