I need to write a Windows batch file to loop through all sql files in a directory and call sqlcmd.exe (the SQL Server 2008 command line). Something like this:-
(FOR %%i IN (*.sql) DO sqlcmd -S %1 -d %2 -E -i "%%i")
But I want to drop out of the loop if any of the calls to sqlcmd fails. But nothing I try seems to work. Hope you can help. Thanks.