by Joe Hunter
14. January 2011 20:32
SQL server runs as a service so it does not have access to a network drive mapped as a local drive letter. In order to allow SQL server to have access to a mapped network drive you can run the following:
XP_CMDSHELL ‘NET USE <DRIVELETTER USED> <UNC PATH OF SHARE>
For example with a share called my_share on my_pc mapped to the H: drive the following would give the SQL server service access to it:
XP_CMDSHELL ‘NET USE H: \\my_pc\my_share\’
Note that when SQL server is re-started the mapped drive will be lost so you could place the command in a startup procedure or alternatively if you run the backup in a single script you can place the command at the start of the script.