我安装了带有SSDT的 VS2015 ,以及 SSMS和SqlServer PowerShell 模块(包括invoke-sqlcmd
命令),但是如果我尝试像这样对 Azure SQL 数据仓库执行查询:
invoke-sqlcmd -Query "Select top 5 * from customer" -ConnectionString "Server=tcp:my.database.windows.net,1433;Database=Customer; Authentication=Active Directory Integrated; Encrypt=True; "
我收到以下错误:
invoke-sqlcmd : Unable to load adalsql.dll (Authentication=ActiveDirectoryIntegrated). Error code: 0x2. For more information, see
http://go.microsoft.com/fwlink/?LinkID=513072
At line:1 char:1
+ invoke-sqlcmd -Query "Select top 5 * from vwOffer" -ConnectionStrin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
invoke-sqlcmd :
At line:1 char:1
+ invoke-sqlcmd -Query "Select top 5 * from vwOffer" -ConnectionStrin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException
+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptComman
如果我尝试直接安装adalsql.dll,我会收到一条消息,说明A higher version already exists
我可以看到两个版本的 dll 都可以在这里找到:
C:\Windows\SysWOW64\adalsql.dll
C:\Windows\System32\adalsql.dll
然而,invoke-sqlcmd 找不到它。知道如何 (A) 注册现有的 dll 以便 invoke-sqlcmd 可以找到它或 (B) 卸载它以便重新安装它吗?
顺便说一句,我可以将 Active Directory Authenticatoin 与 32 位 SQLCMD.exe 一起使用,所以我知道 32 位 dll 工作正常。只是 64 位 dll 没有正确加载...