Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio team services online - running a sql script

I have a build that I've setup using visual studio team services online. I want to execute a sql script on a remote server as a step, but don't see anything available out of box. The remote server has the agent installed on it. What's the best practice for doing this? Just put in a step that runs a powershell/bat file on the server and have that file execute the sql script?

like image 645
Chris Whisenhunt Avatar asked Jan 20 '16 20:01

Chris Whisenhunt


People also ask

Can you use Visual Studio for SQL?

SQL Server Data Tools for Visual Studio. Turn Visual Studio into a powerful development environment for SQL Server, Azure SQL Database and Azure SQL Data Warehouse.


2 Answers

You can add a step to run a PowerShell/batch script to execute the SQL script, and you can also create a custom build task and upload it to VSTS using TFX-CLI. For the custom task, refer to this link for details: http://shiningdragonsoftware.net/2015/08/13/tfs-build-2015-vnext-custom-tasks/

like image 57
Eddie Chen - MSFT Avatar answered Oct 09 '22 20:10

Eddie Chen - MSFT


Nowadays there is a Build Task available in the VSTS marketplace. As far as I can tell it's the powershell solution as mentioned in another answer, but then nicely wrapped up in a package.

like image 36
DdW Avatar answered Oct 09 '22 20:10

DdW