nancyd1111
Technical User
Hi,
I am trying to erase a file using xp_cmdshell and my filename is stored in a variable. Can you tell me how I allow xp_cmdshell to interpret my filename instead of taking it as a literal?
Thanks in advaince!
-------------------------------------------------------
set @filename = N'\\AUTOPILOT\cdrive\Trace\Trace_' + @PlanName + '.trc'
Print @filename
exec master..xp_cmdshell 'erase @filename'
The message displayed is:
Could Not Find C:\WINDOWS\system32\@filename
I am trying to erase a file using xp_cmdshell and my filename is stored in a variable. Can you tell me how I allow xp_cmdshell to interpret my filename instead of taking it as a literal?
Thanks in advaince!
-------------------------------------------------------
set @filename = N'\\AUTOPILOT\cdrive\Trace\Trace_' + @PlanName + '.trc'
Print @filename
exec master..xp_cmdshell 'erase @filename'
The message displayed is:
Could Not Find C:\WINDOWS\system32\@filename