【发布时间】:2018-09-18 22:12:10
【问题描述】:
我在一个表中有一些行,其中有一列名为“query_server”。
Invoke_ASCmd 命令必须在不同的查询服务器(称为 Destination_server)上调用两次(2 行),如下所示:
foreach($row in $Table | where { $_.cube_name -match $CUBE -and $_.active -match $Active })
{
$Destination_Server = $row.Item("query_server")
$sync_output += "_$Destination_Server.txt"
Invoke-ASCmd –InputFile $XML_file -Server $Destination_Server >$sync_output
}
我试过这样做,但它不起作用
$i=0
foreach($row in $Table | where { $_.cube_name -match $CUBE -and $_.active -match $Active })
{
@($Destination_Server) = $row.Item("query_server")
$sync_output += "_$Destination_Server.txt"
Invoke-ASCmd –InputFile $XML_file -Server $Destination_Server[$i] >$sync_output
$i++
}
抛出错误:
- @($Destination_Server) = $row.Item("query_server")
- ~~~~~~~~~~~~~~~~~~~~~~~~~ 赋值表达式无效。赋值运算符的输入必须是能够接受的对象 赋值,例如变量或属性。
- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorId : InvalidLeftHandSide
【问题讨论】:
标签: sql-server powershell