0
我有一个"SQL"
脚本,需要通过Windows Powershell
运行才能创建数据库。该脚本已经具有删除和创建功能,因此不需要在命令行末尾添加数据库名称。试图执行的命令行,当我,说使用Windows执行SQL脚本Powershell
"Invoke-Sqlcmd : A network-related or instance-specific error occurred while establishing a connection to SQL Server
The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
At line:1 char:14
+ invoke-sqlcmd <<<< -inputfile "c:\A.sql" -serverinstance "Louis_dev\MSSQLSERVER"
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
+ FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
Invoke-Sqlcmd :
At line:1 char:14
+ invoke-sqlcmd <<<< -inputfile "c:\A.sql" -serverinstance "Louis_dev\MSSQLSERVER"
+ CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException
+ FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand"
不知道这是否是调用命令,我已经按照这个链接How to execute .sql file using powershell?步骤的错误。有没有可能有这个错误的解决办法。 SQLSERVER
实例已配置为LocalSystem
而不是网络实例
您的SQL实例已启用TCP/IP和命名管道协议? –
我在哪里可以检查这个? – Louis
据此我的SQLServer实例安装为LocalSystem。我必须将其更改为网络服务吗? – Louis