我想通過PowerShell使用.sql文件創建表。Invoke-Sqlcmd:建立與SQL Server的連接時發生網絡相關或實例特定的錯誤
運行在Windows PowerShell ISE以下爲管理員:
Invoke-Sqlcmd -InputFile 'D:\SQL Scripts\test.sql' -ServerInstance 'localhost\MSSQLSERVER' -Database 'Test'
但是,這是給下面的錯誤:
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)
可以在任何一個請指導,以解決這個問題。
我已經審閱execute .sql using powershell