I have a case where i have got 10+ SQL script
.
I don't want to go and run all my scripts 1 by 1.
Is there a way that i can run all my scripts in succession in SQL Management studio
.
I found this post. Creating a batch file seems easier.
This is all you need:
@echo off
ECHO %USERNAME% started the batch process at %TIME% >output.txt
for %%f in (*.sql) do (
(
sqlcmd.exe -S servername -E -d databasename -i %%f >>output.txt
)
pause
Replacing servername and databasename, but it seems to be not working.
Any ideas?
@echo off
command from the batch file and try again? Also, try addingECHO %PATH%
to the start of the batch file and check that the path for SQLCMD.EXE is included. – Carcinomatosissqlcmd.exe
on the same line as thedo
? I notice that you appear to have an unclosed parenthesis in your script. – Carcinomatosis