Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HI everyone, hope you are all well, I need help for SQL server xp_cmdshell i am trying to add the SQL job to delete all

HI everyone, hope you are all well, I need help for SQL server xp_cmdshell

i am trying to add the SQL job to delete all the files inside folder but when I am running the query i am getting this message, does anybody can help me for this issue to fix, please.

this is my sql query :

EXEC master.dbo.xp_cmdshell 'for /d %x in (C:\{cdr@acc}\{acc@sap}\{sap@ppp}\tmpbox\*) do @rd /s /q %x' EXEC master.dbo.xp_cmdshell 'del C:\{cdr@acc}\{acc@sap}\{sap@ppp}\tmpbox\ /Q'

and this what I am getting in output, which does not delete any files inside the folder

output C:\{cdr@acc}\{acc@sap}\{sap@ppp}\tmpbox\709_TimeSheet_Brandon T Brooks_Shahram_Mehri_Kalantari_01_17_2019_09_00_51.pdf Access is denied. C:\{cdr@acc}\{acc@sap}\{sap@ppp}\tmpbox\709_TimeSheet_Daniella Woolfolk_Shahram_Mehri_Kalantari_01_17_2019_10_18_50.pdf Access is denied. NULL

Best Regards

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions