我正在尝试创建一个 shell 脚本来运行查询并存储输出,到目前为止我的脚本如下所示:
push-location;
import-module SqlPs;
Pop-Location;
$myData = invoke-sqlcmd -InputFile "C:\<path>\blah.sql" -serverinstance dbatest -database testdb;
$mydata | out-file C:\Users\<path>\shelloutput.csv;
remove-module sqlps;
It loads SqlPs fine which I can check with with Get-Module -ListAvailable
producing this
but when I do invoke-sqlcmd
it is not recognized:
关于我还能做什么的任何想法?
Edit 1
When I add the option -Verbose
I see this error saying that some files are already present. Is this error preventing me from loading the module? When I do Get-Module
it doesn't list the SQLPS module.
EDIT 2
Loading the 32 bit version gives me fewer errors but still errors loading files...now only 2 files are missing as opposed to 5 earlier
我发现在我的系统上,在 64 位路径之前,路径中有几个对 32 位(程序文件 (x86))路径的 sql bin 引用。我将所有 32 位路径移至 64 位路径下方,这解决了问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)