0

I have a folder with 55 .sql files, SQL scripts.

Each file consists of 10000 insert statements. I'm using this command to run each file:

C:\sqlcmd -S . -d Minuf_Customers_July -i C:\ACL\MyScript3.sql

And I need to do it for MyScript1 , MyScript2.. to MyScript54.

Is there a way to loop through all the commands in the command prompt?

But it is important! that the each row will run separately because otherwise it will throw an "out of memory" error.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jordan1200
  • 478
  • 1
  • 5
  • 20

1 Answers1

0

The DOS command for is your friend.

for %f in (*.sql) do sqlcmd -S . -d Minuf_Customers_July -i %f

The command help for gives details of various options.

simon at rcl
  • 7,326
  • 1
  • 17
  • 24