I am trying to work out how to achieve my test run to validate or ensure my script run through an SQLCMD has run successfully. I have been able to get it to also provide a text file output, but I really want to ensure the process gives the time for the command to run and then validate a successful finish.
I have the test opening up the CMD prompt windows on my desktop and then running the following code:
Code: Select all
sqlcmd -S serverIP -d DB name -U Username -P password -i C:\path\script.sql
This then runs the script, but I am not sure how to then allow this to run and then validate it was successful.
I have then also added this code below, which writes the ouptut to a text file:
But again, I do not know how to give this time to finish and validate it was successful.
Any help would be appreciated. Thank you.