Skip to content

Instantly share code, notes, and snippets.

@aadennis
Created December 18, 2019 09:27
Show Gist options
  • Save aadennis/b5ccacb23b9d00e6a4a66f2b046ef9ea to your computer and use it in GitHub Desktop.
Save aadennis/b5ccacb23b9d00e6a4a66f2b046ef9ea to your computer and use it in GitHub Desktop.
$funcVars = @(
"name='john'",
"age=22"
)
$dbServer = "localhost"
$dbPrefix = "AA_"
$dbName = "SomeDb"
$inputFile = "$PSScriptRoot\x.sql"
$database = "$($dbPrefix)$($dbName)"
$user = "sa"
$pwd = "Alive123"
$envParams = @{
ServerInstance = $dbServer
Database = $database
InputFile = $inputFile
User = $user
Password = $pwd
}
$envParams['Variable'] = $funcVars
Invoke-Sqlcmd @envParams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment