title: BCP Utility Not returning/Hangs
body: <p>I am creating a very simple stored procedure to export the output of a query to a text file using BCP as shown below.</p>
  
  <p>When I execute the SP from SQL Management Sudio, the results pane just sits there with "Executing Query..." It doesn't return an error nor come back.</p>
  
  <p>Any help is appreciated..I have spend a lot of time on this already.</p>
  
  <pre><code>CREATE procedure spTestShell
  WITH EXECUTE AS 'CmdShell'
  AS
  BEGIN
  
      DECLARE @Command varchar(512)
  
      set @Command = 'bcp "SELECT * FROM DBName.dbo.[ImportFileTable]" queryout "C:\bcptest.txt" -T -c -S' + @@SERVERNAME
  
      print @Command  
      EXEC xp_cmdshell @Command
  
  END
  
  exec spTestShell 
  </code></pre>