Tuesday, August 20, 2013

Release multiple SQL Server scripts to Production Server using batch file

I am writing this blog for one on my colleague Kallidile, Sujith who wants to do this task for his Production Deployment repeatedly. This is also dedicated to all DBA team who are also doing same.
To solve this problem, I have created a batch file which will read all SQL files from folder excluding child folder and use SQLCMD to execute scripts file to specified Data Source.
How to run batch file ?
1. Copy batch file “ReleaseSQLServerScripts.bat” to location from where you want to release SQL files.
2. Click on “ReleaseSQLServerScripts.bat” to execute batch file.
3. Batch file will ask Server Name where you want to deploy your scripts.
image4. Batch file will ask you to click any key before executing each script.
image5. Once click any key, It will execute this script to Target Server and display output.
image6. Once all scripts are deployed, It will ask to click any key to close window.
image
Below is the batch file to download.
Note:
  1. We are using window authentication for deployment.



1 comment: