I've got a maintenance script that is generating .sql
files with some SQL script in there.
When the file size reaches a limit, I close the file and create a new one, dumping the data into the 2nd file.
I have no idea how many files will be generated (it's based upon the amount of data at the current time). So far it looks like it's about 100 files or so.
So, is there a nice way I can say
- Get all the files that end with
.sql
from a target directory. - now run this command for each one.
The command I run in the Command window on my SQL Server is this:
sqlcmd -S 127.0.0.1 -d SomeDBTenant -U someUser -P somePassword -I -i c:\temp\SqlScript_1.sql