Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to get the SQL agent job (task) to run my query then put the output file to network drive. When I select the output file the only drives listed are local. I'm new to jobs and MSSQL but have a good knowledge of MySQL.

If I choose a local disk the job completes just fine. If I manually put the drive letter of the mapped drive in the output file field nothing happens.

Thanks

share|improve this question

1 Answer 1

In windows, drive mappings are on a user account basis. This means that the user account that the SQL Agent runs under can't see drive mappings made by a different user (like the account used to administer the server).

A workaround is to use a UNC path name to point to the share. Just type in whatever file path you like into the "Output File:" field in the Job Step Properties dialog box. You might want to dream up some sort of naming convention to keep server names, job names and steps straight. Something like: \superbigfileserver\sqllogshare\sqlagentlogs\dbinstancename\a_sql_job_name.step_number.txt

Of course, the account used for SQL Agent should have sufficient permissions to access the relevant share, path and file.

If you are worried about the name of the file server changing, set up a CNAME via DNS and use that name instead of the "real" file server name.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.