question

Nitin Kumar avatar image
Nitin Kumar asked

How to create a JOB to be executed at some specific time.

I have to write a JOB in sql server 2005 to be executed everyday 12AM. Please help me to create a JOB.

sql-agentjobuser
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jay Bonk avatar image
Jay Bonk answered

The easiest way would be to use SQL Server Agent to schedule your job to run every day at 12AM.

This link should point you in the right direction:

http://msdn.microsoft.com/en-us/library/ms187880.aspx

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Christopher Klein avatar image
Christopher Klein answered

You need to make sure that the SQL Agent service is running on the machine. You can create a job in two ways, and the first leads to the second. Inside SMSS go into SQL Server Agent->Jobs->(right-click)->new jobs

from there you can give your job a name and create any steps from 'Steps' and set the time from 'Schedules'.

the second way to create a job is via script and if you create the job initially via SMSS you can script that job out to a file to see how it is created.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.