I'm trying to put together a batch file to run a large number of .sql files without doing so individually.
So far I have:
@echo off
echo "Enter Server"
set /p SERVER=
echo "Enter Database"
set /p DATABASE=
del *.log
for /r %%i in (*.sql) do sqlcmd -E -S %SERVER% -d %DATABASE% -i"%%i" -m0 -o"%%i.log" -w500
pause
This works as far as it goes.
However what I really want to do is route any errors to a separate .err file, so that it is very clear at a glance which of the (100+) files failed.
I saw the :Error parameter, but I'm not sure how to apply it here.
Is there an easy way to acheive this?