Answered by:
How to execute SQL scripts in batch

Question
-
Hi,
I have separate scripts for Creation of Tables, Stored Procedures, Views, Triggers in different .sql files.
I have to execute thses scripts in batch in different servers and different databases without opening SSMS.
All .sql files to be executed in single command.
Please suggest how to achieve?
Appreciate your help.
Regards,
BalaWednesday, April 8, 2015 8:49 AM
Answers
-
Try with sqlcmd
Ref: https://www.simple-talk.com/sql/sql-tools/sql-server-sqlcmd-basics/
Please mark this reply as answer if it solved your issue or vote as helpful if it helped.
[Blog]- Proposed as answer by Michelle Li Thursday, April 9, 2015 9:10 AM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, April 16, 2015 1:52 AM
Wednesday, April 8, 2015 8:55 AM -
you can use sqlcmd
https://msdn.microsoft.com/en-us/library/ms162773.aspx
other options are osql,isql
https://technet.microsoft.com/en-us/library/aa214012%28v=sql.80%29.aspx
https://technet.microsoft.com/en-us/library/aa214007%28v=sql.80%29.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page- Proposed as answer by Michelle Li Thursday, April 9, 2015 9:10 AM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, April 16, 2015 1:52 AM
Wednesday, April 8, 2015 9:05 AM
All replies
-
Try with sqlcmd
Ref: https://www.simple-talk.com/sql/sql-tools/sql-server-sqlcmd-basics/
Please mark this reply as answer if it solved your issue or vote as helpful if it helped.
[Blog]- Proposed as answer by Michelle Li Thursday, April 9, 2015 9:10 AM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, April 16, 2015 1:52 AM
Wednesday, April 8, 2015 8:55 AM -
you can use sqlcmd
https://msdn.microsoft.com/en-us/library/ms162773.aspx
other options are osql,isql
https://technet.microsoft.com/en-us/library/aa214012%28v=sql.80%29.aspx
https://technet.microsoft.com/en-us/library/aa214007%28v=sql.80%29.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page- Proposed as answer by Michelle Li Thursday, April 9, 2015 9:10 AM
- Marked as answer by Lydia ZhangMicrosoft contingent staff Thursday, April 16, 2015 1:52 AM
Wednesday, April 8, 2015 9:05 AM