我有这个 PowerShell 脚本:
$QUERY = "SELECT name FROM sys.databases";
$Databases = invoke-sqlcmd -serverinstance "SQLInstanceName" -database "master" -Query $QUERY
foreach ($dbname in $Databases)
{
$dbname
}
假设我想要数据库的恢复模型如下,我如何将它们放入 PowerShell 变量中?
$QUERY = "SELECT name, recovery_model_desc FROM sys.databases";