title: xp_cmdshell could not find server
body: <p>I have enabled the <code>XP_CMDSHELL</code> and tried to execute the following line of code:</p>
  
  <pre><code>EXEC Master..XP_CMDSHELL 'bcp "exec server.db.dbo.SProc" queryout c:\test\test.txt -k -t \t -c -S localhost -T';
  </code></pre>
  
  <p>but I got the following error:</p>
  
  <blockquote>
    <p>SQLState = 37000, NativeError = 7202
    Error = [Microsoft][SQL Server Native
    Client 10.0][SQL Server] Could not find
    server in sysservers. Execute
    sp_addlinkedserver to add the server
    to sysservers.</p>
  </blockquote>
  
  <p>But when I execute the stored procedure outside <code>XP_CMDSHELL</code> it works fine.</p>
  
  <p>Any suggestions?</p>