• Next step would be, in non-destructive scripting, foreach

    e.g.

    (Using 2 batch files)

    In first, pick which files to run:

    @Set Svr=ServerToRunAgainst

    @Rem For Non-Integrated @Set lgn=-U sa -P password

    @Set lgn=-E

    @Set Db=-d SOMEDB

    @for /R "..\Create Scripts" %%f in (*.Sql) do Call ProcessOneFile.Bat "%%f"

    And in second, the ProcessOneFile:

    @SET passedInFile=%1

    @SET passedInFile=%passedInFile:"=%

    @Set TmpFileFull=C:\Temp\Tmp.Sql

    @copy "%passedInFile%" "%TmpFileFull%"

    @Echo Processing %passedInFile%

    @SqlCmd -S %Svr% %lgn% %Db% -i "%TmpFileFull%"

    To deploy, I run the batch file. It will then run every SQL file in the subfolder "Create Scripts"

    Copy to the Tmp was to work around the long name issues

    Can, of course, modify the SqlCmd, for me it's an environment variable with a FULL path to oSql