Dos batch to return 1 or 0 exit code after SQL query.
Posted: 18 Nov 2011 03:23
I know this is basic stuff but I just can't figure it out.
I need to do a sql query & depending on the outcome return an exit code of 1 or 0.
It's to determine which is the principal database in a mirror pair & therefore which database should be backed up by my backup app.
So the backup app runs the batch ... which runs a sqlcmd ... which returns a yes or no.
How do I return this as an exit code to the app.
I know how to output a 0 or 1 to a text file but can't suss how to return an exit code.
Grateful for any help at all!!!
Thanks.
I need to do a sql query & depending on the outcome return an exit code of 1 or 0.
It's to determine which is the principal database in a mirror pair & therefore which database should be backed up by my backup app.
So the backup app runs the batch ... which runs a sqlcmd ... which returns a yes or no.
How do I return this as an exit code to the app.
I know how to output a 0 or 1 to a text file but can't suss how to return an exit code.
Grateful for any help at all!!!
Thanks.