Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 找不到与参数名称';连接字符串';_Sql_Powershell - Fatal编程技术网

Sql 找不到与参数名称';连接字符串';

Sql 找不到与参数名称';连接字符串';,sql,powershell,Sql,Powershell,我正在尝试使用连接字符串连接到数据库并运行.sql脚本 尝试运行时: Invoke-Sqlcmd -ConnectionString $CString -InputFile .\deleteOldData.sql 我得到了这个错误: 找不到与参数名称“ConnectionString”匹配的参数。 has-ConnectionString作为Invoke-Sqlcmd的一部分列出,所以我不明白为什么该命令不起作用 模块SQLPS有一个Invoke Sqlcmd,它没有-ConnectionSt

我正在尝试使用连接字符串连接到数据库并运行.sql脚本

尝试运行时:

Invoke-Sqlcmd -ConnectionString $CString -InputFile .\deleteOldData.sql
我得到了这个错误:

找不到与参数名称“ConnectionString”匹配的参数。


has-ConnectionString作为Invoke-Sqlcmd的一部分列出,所以我不明白为什么该命令不起作用

模块
SQLPS
有一个
Invoke Sqlcmd
,它没有
-ConnectionString
参数。在
SqlServer
模块中还有一个
Invoke Sqlcmd

Install-Module -Name SqlServer
有关更多详细信息,请参见此

SQLPS:SQLServer安装中包含SQLPS模块 (用于向后兼容),但不再更新。最 最新的PowerShell模块是SqlServer模块


你确定你使用的是正确的模块吗?模块中存在相同的cmdlet,并且该版本没有
-ConnectionString
作为参数。