SQL Server Agent Job – Exists then Drop?

Try something like this: DECLARE @jobId binary(16) SELECT @jobId = job_id FROM msdb.dbo.sysjobs WHERE (name = N’Name of Your Job’) IF (@jobId IS NOT NULL) BEGIN EXEC msdb.dbo.sp_delete_job @jobId END DECLARE @ReturnCode int EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N’Name of Your Job’ Best to read the docs on all the parameters required for ‘sp_add_job’ and ‘sp_delete_job’

How to create jobs in SQL Server Express edition

SQL Server Express doesn’t include SQL Server Agent, so it’s not possible to just create SQL Agent jobs. What you can do is: You can create jobs “manually” by creating batch files and SQL script files, and running them via Windows Task Scheduler. For example, you can backup your database with two files like this: … Read more