July 23, 2021 at 1:15 pm
What would the preferred method of outputing a cmdexec step?
2. go to advanced page and enter output file there?
July 23, 2021 at 9:08 pm
My preference is option 1 because then the command will write all the output PLUS the errors to the log file. It also allows you to have 2 logs - an output log and an error log. Downside to your approach is that you lose all execution history in the logs UNLESS you change your > to >>, but then you need to maintain the logs to ensure they don't grow out of control (which they will).
That being said, I personally don't like doing non-SQL things inside SQL Server. Calling a cmd file to me is an operation that should be handled by a different tool. Now, there are use cases where I would say go for it, but for the most part, I try to do stuff with my data inside SQL and anything that isn't related to my data happens outside of SQL Server.
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply