title: Formatting output in SQLCMD mode?
body: <p>Is there a way I can specify output file format in <strong>SQLCMD mode</strong> so that I can read it back using <code>BULK INSERT</code>? I want to do something like this:</p>
  
  <pre><code>:CONNECT SERVER1
  :OUT 'E:\test'
  
  SELECT TOP 100 ID, NAME
  FROM DB1.dbo.TABLE1
  
  GO
  
  :CONNECT SERVER2
  :OUT 'E:\test2'
  
  CREATE TABLE #TEMP(ID INT, NAME VARCHAR(100))
  
  BULK
  INSERT #TEMP
  FROM 'E:\test'
  WITH
  (
    FIELDTERMINATOR = ',',
    ROWTERMINATOR = '\n'
  )
  GO
  
  SELECT *
  FROM DB2.dbo.TABLE2
  WHERE ID IN (SELECT ID FROM #TEMP)
  
  -- Other queries for #TEMP
  
  GO
  </code></pre>