In the directory 'C:\scripts' I am having script files in '.sql' format.How to execute all these files at the time using sql query from my SQL SERVER MANAGEMENT STUDIO.
Asked
Active
Viewed 4,509 times
0
-
hi, welcome to StackOverflow! Please take the tour here: http://stackoverflow.com/tour – Eduard Uta Nov 28 '14 at 10:39
-
Open them all in SSMS and run them one by one? – mordack550 Nov 28 '14 at 10:46
-
mordack -Please tell once if know answer – Saravana Kumar Nov 28 '14 at 10:51
2 Answers
1
If this linked post contains the info you need then I suggest marking your post as duplicate of the linked one: Run all SQL files in a directory
Otherwise, check if this helps: http://www.sql-server-helper.com/tips/execute-sql-scripts-batch.aspx

Community
- 1
- 1

Eduard Uta
- 2,477
- 5
- 26
- 36
0
make a batch file with anyname.bat
and save it in the same directory, save it and run it.
this sample of mysql
@ECHO OFF
ECHO Running scripts
FOR %%i IN (*.sql) DO mysql -uroot -proot databasename< %%i
ECHO Finished!
pause

Sindhoo Oad
- 1,194
- 2
- 13
- 29
-
-
sql is Structured Query Language, it is used to query your database not to run `.sql` files placed somewhere in your system. what is the need to do so? – Sindhoo Oad Nov 28 '14 at 10:57