Can I script out SQL Server jobs programmatically?

  • Does anyone know how to script out a complete job definition (job creation script) from a T-SQL query? In SQL Server Managment Studio, you can right click a job and script out a complete definition. I just want to call this same functionality from code rather than the UI. I am using SQL Server 2005.

  • Hi,

    maybe a profiler trace can help to find out what the management studio is doing when it scripts out a job...just an idea 🙂

  • Google can help you find many scripts that can do this for you.

    Also, the FineBuild product on CodePlex has a spScriptJobs stored procedure which you can use.

    Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.

    When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply