How do I update a PowerShell variable using an Invoke-Sqlcmd statement?
Eg.
$PSVariable
Import-Module sqlserver
$QueryStatement = "SELECT $PSVariable = Max(Data) FROM MyDatabase"
Invoke-Sqlcmd -ServerInstance "MyServer\Instance" -Query $QueryStatement
Not sure what is off with this code. I am new to the PowerShell sqlserver module