I am using some dos commands to do file operations & bcp command in my sql server stored procedure. So I am setting xp_cmdshell on and off many times. I am doing this multiple times because, if I just enable once at the start of SP and disables at the end of SP, many times I get the error saying xp_cmdshell not enabled.
SO I am enabling and disabling at each dos command in my SP. By doing this, is there any load on sql server or any performance issues?
Also I want a way to set this xp_cmdshell enabled always. Is there any way to do this?