title: Running queries using osql
body: <p>When executing any one of the following commands:</p>
  
  <pre><code>osql -E -S ComputerName\InstanceName
  osql -E -S ComputerName\InstanceName -i MyScript.sql -o MyOutput.rpt
  osql -E -q "SELECT * FROM Northwind.dbo.Shippers"
  osql -E -Q "SELECT * FROM Northwind.dbo.Shippers" -o MyOutput.rpt
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>[SQL Server Native Client 10.0]SQL Server Network Interfaces: Connection
  string is not valid [87].
  [SQL Server Native Client 10.0]Login timeout expired
  [SQL Server Native Client 10.0]A network-related or instance-specific error
  has occurred while establishing a connection to SQL Server. Server is not
  found or not accessible. Check if instance name is correct and if SQL Server
  is configured to allow remote connections. For more information see SQL Server
  Books Online.
  </code></pre>
  
  <p>However, I am able, without issue to login and run <code>SELECT</code> queries from SSMS. </p>
  
  <p><strong>How do I run queries against SQL Server 2008 using osql?</strong></p>