Reputation: 1194
I'm running SQL Server 2008 locally. I have a pile of scripts I would like to run on my local database. I can connect to the server and run them manually but I have over a 100 scripts, and I'm sure there is a way to do this. Any help is appreciated, thanks!
Upvotes: 2
Views: 185
Reputation: 1212
You can iterate all query files in a directory and execute them with osql utility.
@echo off
for %%f in (*.sql) do (
echo executing %%f
osql -E -i %%f
)
pause
Upvotes: 3