Search code examples
sql-servertfs.net-coredevopstfs-2015

Run SQL Agent Job from TFS


How do I run a SQL Agent Job from TFS Server? We are creating a data warehouse.

I have published a database schema with following

sqlpackage.exe /publish with publish profile.

Now I want to run a SQL Agent Job to Populate the Data Warehouse. I do Not want to place the sql agent job in post deployment script.

EXEC msdb.dbo.sp_start_job 
    @job_name='TestPackage' 
    ,@server_name='TestServer1234'

enter image description here

Using SQL Server 2016 Enterprise.


Solution

  • You can use the Command Line Task and provide the commands to execute your provided TSQL script.

    sqlcmd.exe -S servername -d Databasename -U username -p password -i inputScript.sql