views:

26

answers:

2

How can you create a new job in SQL Server 2005 with the use of code? And not in SQL Server Management Studio.

+3  A: 

There's a series of system stored procedures that you should use as detailed on MSDN:

sp_add_job
sp_add_jobstep

Plus a couple more for settings up schedules.

AdaTheDev
+1  A: 

To see how it's done by example, you can make a job in Management Studio, then right-click / script the job out to a query window.

onupdatecascade