如何使用访问SQL Server数据库。通过设置位置输入名称

如何使用访问SQL Server数据库。通过设置位置输入名称,sql,sql-server,powershell,sqlps,Sql,Sql Server,Powershell,Sqlps,问题在标题中。我有一个数据库服务器,它有许多数据库的名称中都有句点(它们是URL,这样我就知道哪个数据库与哪个站点相关,比如foo.bar.com\u content)。当我导航到SQLSERVER:\sql\[server]\default\databases并运行get childitem时,我可以看到我所有数据库的列表。当我尝试cd[带句点的数据库名称]时,我得到以下错误: Set-Location : SQL Server PowerShell provider error: The n

问题在标题中。我有一个数据库服务器,它有许多数据库的名称中都有句点(它们是URL,这样我就知道哪个数据库与哪个站点相关,比如foo.bar.com\u content)。当我导航到
SQLSERVER:\sql\[server]\default\databases
并运行
get childitem
时,我可以看到我所有数据库的列表。当我尝试
cd[带句点的数据库名称]
时,我得到以下错误:

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
设置位置:SQL Server PowerShell提供程序错误:指定的密钥数与寻址此对象所需的密钥数不匹配。所需的密钥数为:Name。
第1行字符数:3

+cd考虑到数据库名称为
foo.bar.com\u content
,请尝试将句点
更改为其十六进制值
%2e
,如下所示

cd [foo%2ebar%2ecom_content]

考虑到数据库名称为
foo.bar.com\u content
,请尝试将句点
更改为其十六进制值
%2e
,如下所示

cd [foo%2ebar%2ecom_content]

Rahul的回答通常是正确的,但去掉括号。这是对拉胡尔回答的更正

cd foo%2ebar%2ecom_content
如果您的姓名约定使用空格,则将其括在引号中(单引号或双引号均可)


Rahul的回答通常是正确的,但去掉括号。这是对拉胡尔回答的更正

cd foo%2ebar%2ecom_content
如果您的姓名约定使用空格,则将其括在引号中(单引号或双引号均可)