0

How to deploy the SQL scripts to the local database (one-click deployment)?

On a periodic interval, we receive .sql files from Developers. I will have to automate the process of pushing all .sql files to mapped database.

I am trying to get some help on osql / batch script syntax to deploy .sql files.

1

I think you can get your answer from this link:

https://stackoverflow.com/questions/2583517/run-all-sql-files-in-a-directory

You can also check below site for more details on SQLCMD utility:

https://ssqlforest.wordpress.com/2016/10/31/how-to-use-sql-server-database-from-sqlcmd-prompt/

SQLCMD Options

You can use database name within the script or -d option if all scripts have to go in the same database. Kindly ensure that queries are separated in batch i.e. go keyword after each SQL statement.

  • Thank you.. this is helpful. I will work on the batch script execution – goofyui Apr 2 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.