title: Map to Network Drive By SQL SP
body: <p>Is there any way to map to a network drive by using a stored procedure? I have tried: </p>
  
  <pre><code>xp_cmdshell 'net use Q: [shared_network_drive] [pwd] /user:[username]'
  </code></pre>
  
  <p>but I got an error saying something like </p>
  
  <pre><code>'System error 1312 has occurred.'
  'A specified logon session does not exist. It may already have been terminated.'
  </code></pre>
  
  <p>However, when I run the same command in a cmd console in the same box as the SQL server machine, there is no problem at all. It looks like that SQL process does pass correct logon credential information. Any way to do it by SQL SP?</p>