April 11, 2012 at 9:30 am
Hi, we are currently using batch files with scheduled tasks for most of our backup copying, zipping, etc. at the file system level. I would like to move towards having all the commands execute within the SQL Agent jobs.
Using Operating System (CmdExec) scripts, I can execute zip utilities and copy / move files. However, I have had trouble with translating all the commands from batch into the command window in SQL Agent. For example, I am having trouble with * wildcard for file names, and using %vairables% for strings has been giving me trouble as well. For some reason this is breaking my job as it cannot find the files I am searching for.
Does anyone know how to use wildcards in the SQL Agent cmd window, what about setting having variables and concatenating with strings?
Also, what would be some helpful resources on programming with the CmdExec window? So far it has been trial and error and I have not found a good website or resources with comprehensive help on this.
April 11, 2012 at 12:12 pm
Ok, the wildcards are actually working now. It must have been something else in my script throwing it off befoer I ran those statements.
As for returning variable values, I had to call cmd.exe /c "commandgoeshere" to get command to execute from SQL Agent. Note: you get access is denied unless the proxy account running the job has permissions to read & execute cmd.exe.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply