【发布时间】:2014-09-22 16:38:09
【问题描述】:
问题在标题中。我有一个数据库服务器,其中有许多名称中有句点的数据库(它们是 url,以便我知道哪个数据库与哪个站点相关联,例如 foo.bar.com_content)。当我导航到SQLSERVER:\sql\[server]\default\databases 并运行get-childitem 时,我可以很好地看到我所有数据库的列表。当我尝试cd [database name with period] 时,出现以下错误:
Set-Location : SQL Server PowerShell provider error: The number of keys specified does not match the number of keys required to address this object. The number of keys required are: Name.
At line:1 char:3
+ cd <<<< '[database name with periods here]'
+ CategoryInfo : InvalidData: (SQLSERVER:\sql\...t.org_Content:SqlPath) [Set-Location], GenericProviderException
+ FullyQualifiedErrorId : KeysNotMatching,Microsoft.PowerShell.Commands.SetLocationCommand
那个错误重复了四次,接着是:
Set-Location : Cannot find path 'SQLSERVER:\sql\[servername]\default\databases\[database name with periods here]' because it does not exist.
At line:1 char:3
+ cd <<<< '[database name with periods here]'
+ CategoryInfo : ObjectNotFound: (SQLSERVER:\sql\...t.org_Content:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
我可以在同一台服务器上对名称中没有句点的数据库运行相同的命令并正常连接。
我在 Powershell ISE、Powershell v2.0 中的 Windows 桌面计算机上运行此程序,并安装了 SQL Server 2012 工具。远程数据库服务器正在运行 SQL Server 2008r2。
【问题讨论】:
标签: sql sql-server powershell sqlps