Job runs with Sucess but does not delete file

HKFuey
HKFuey used Ask the Experts™
on
I have this job step to delete a flat file created by a SQL job: -
xp_cmdshell 'del Z:\AXDATA.txt'

It runs sucesssfully.

The actual file is AXData.txt with some lower case characters, is this the issue? I changed it to lower case in the job step but it just reverted back
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
It is SQL 2008
Raja Jegan RSQL Server DBA & Architect, EE Solution Guide
Awarded 2009
Distinguished Expert 2018

Commented:
>> I have this job step to delete a flat file created by a SQL job

Does the SQL Job owner account or the account under which the SQL Job executes have access to DELETE the file from the Z:\ drive..
Hope Z:\ drive is a shared folder and if so, then try deleting that file by providing the Full UNC path like
 \\servername\path
instead of mapping as Z:\ drive and then deleting from Z:\ drive.

Author

Commented:
Yes. we have delete access to the file. I have tried UNC \\filepath and mapped drive Z:\ in the job step.
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Raja Jegan RSQL Server DBA & Architect, EE Solution Guide
Awarded 2009
Distinguished Expert 2018

Commented:
>> I have tried UNC \\filepath and mapped drive Z:\ in the job step

can you kindly try deleting that file by providing the UNC filepath instead of Z:\ drive once..

Author

Commented:
I have already tried both ways using the script and manually.

I'm going to try with a different file name it may be that the upper and lower case is confusing SQL.
Raja Jegan RSQL Server DBA & Architect, EE Solution Guide
Awarded 2009
Distinguished Expert 2018

Commented:
Windows isn't case sensitive to file or folder paths..
Kindly update your findings on another file path..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial