How to execute a SQL File on the server?

We are executing two steps, the second a child of the first. In the first step we deploy a web application, and transform the web.conf and a SQL file (variable-replace). Then in the second step we want to execute that file, but on the Octo server against a 3rd target.

We just purchased Octopudeploy, so we’re trying to get our barrings, any help would really be appreciated.


Thanks for reaching out! There are plenty of ways to execute SQL scripts during a deployment, but our favorite one (because it works in pretty much all cases) is using DBUp.

This will implicate creating a console app to run the script for you. Then from an Octopus script step you’ll just execute that console app.

More info about this, including an awesome walkthrough video here:


DBUp is a great way to manage db deployments but does add a few steps. If you need a strait forward way for one or two things you can run sqlcmd in a post deploy script.