How can I execute SQL scripts using TeamCity?

command-line, continuous-integration, scripting, sql, teamcity

Solution

In a command line build step:

Command executable: `c:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe` Command parameters: `-S <server> -i <path_to_file>` <== Note: that's a capital `-S`!

You may need to change the `100` to something else, depending on the version of the SQL Server tools that you have installed on the build agent.

Problem

I´m new with TeamCity and I don´t know how to run `SQL scripts` with it. Is the way simply selecting the path of those scripts in a Command Line Build Runner ? I´m pretty lost. Regards.

Original source