If there is an error while running the procedure then echo 'error' else 'success'
sqlcmd -S DANAA-LAPTOP -d NewsWebsite -q "SP_DictionaryMain 'NewsWebsite','NEW'"
-o C:\logFile\ReportExE-%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt
If there is an error while running the procedure then echo 'error' else 'success'
sqlcmd -S DANAA-LAPTOP -d NewsWebsite -q "SP_DictionaryMain 'NewsWebsite','NEW'"
-o C:\logFile\ReportExE-%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt
try cmd
&&
and||
operators, where&&
means previous command succesful and||
means previous command failed.as in
you may also write compound commands within parens
or, if you are running a batch script
so, in your case
As you want to
echo
something, error output is suppressed with2>NUL
. Remove it to see error messages fromsqlcmd