How you run all SQL scripts automatically from executable

I have a folder with all the SQL scripts in the project.

I need to create a script that automatically on click executes all the scripts in the folder in Microsoft SQL Server Management Studio.

An executable that automatically loops and executes all scripts in the folder

>Solution :

for %%G in (*.sql) do sqlcmd /S servername /d databasename -i"%%G"

PAUSE

Creates a file in the folder like name.bat/Enter this code and save/Click the file

Leave a Reply