Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuting a SQL script using Windows Powershell
    text
    copied!<p>I have a <code>"SQL"</code> script that needs to be run through Windows <code>Powershell</code> in order to create a database. The script already has the drop and create function in so no need to add a database name at the end of the command line. when trying to execute the command line I get an error that says </p> <pre><code>"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 &lt;&lt;&lt;&lt; -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 &lt;&lt;&lt;&lt; -inputfile "c:\A.sql" -serverinstance "Louis_dev\MSSQLSERVER" + CategoryInfo : ParserError: (:) [Invoke-Sqlcmd], ParserException + FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand" </code></pre> <p>not sure if it is the invoke command and I have already followed the steps in this link <a href="https://stackoverflow.com/questions/10894688/how-to-execute-sql-file-using-powershell">How to execute .sql file using powershell?</a> . Is there by any chance that there could be a workaround from this error. <code>SQLSERVER</code> instance has been configured to <code>LocalSystem</code> and not to Network instance </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload