title: SQL Query fails while running in SQLCMD Mode
body: <p>I need help, I am writing the SQL code shown below for extracting data from multiple servers from the SSMS window of one SQL Server. I have CMC on SERVER1 and have registered SERVER2 as well and all looks good.</p>
  <p>But I have a issue in this code:</p>
  <pre><code>:CONNECT SERVER1
  USE [SOURCE_NAP]
  SELECT [CUST_ID]
  FROM [SOURCE_NAP].[dbo].[Customer] 
  GO
  EXCEPT
  
  :CONNECT SERVER2
  USE [NAP]
  SELECT [CUST_ID]
  FROM [NAP].[dbo].[Customer] 
  GO
  </code></pre>
  <p>When I execute individual selects with <code>:CONNECT</code> above them it works fine but when I want to display the output using an <code>EXCEPT</code> between there two selects, I get this error:</p>
  <pre><code>Connecting to SERVER1...
  Disconnecting connection from SERVER1...
  Connecting to SERVER2...
  </code></pre>
  <blockquote>
  <p>Msg 208, Level 16, State 1, Line 1<br />
  Invalid object name 'NNSW_NAP.dbo.[Customer]'</p>
  </blockquote>
  <pre><code>Disconnecting connection from SERVER2...
  </code></pre>
  <p>Seems like before connecting to another instance it tries to disconnect from earlier instance and hence this error. Any way to fix this else Is there any alternate way around to query data from multiple server and then using <code>EXCEPT/UNION</code> etc between them ???</p>
  <p>Thanks</p>