|
|
Question : How to create scheduled job using Query Analyzer
|
|
Hello all,
Is it possible to create (not run) the scheduled job using Query Analyzer.
Note: My requirement is, When the user implement my application, I want to create some scheduled jobs on their MS SQL Server (user does not aware of SQL Server). Like backup my database, truncate the transaction logs etc. So I want to write a script, that should do this jobs.
|
Answer : How to create scheduled job using Query Analyzer
|
|
sorry...I was obviously not paying close attention. This should be better:
http://msdn2.microsoft.com/en-us/library/ms181153.aspx
To create a SQL Server Agent job
- Execute sp_add_job to create a job. - Execute sp_add_jobstep to create one or more job steps. - Execute sp_add_schedule to create a schedule. - Execute sp_attach_schedule to attach a schedule to the job. - Execute sp_add_jobserver to set the server for the job.
Local jobs are cached by the local SQL Server Agent. Therefore, any modifications implicitly force SQL Server Agent to re-cache the job. Because SQL Server Agent does not cache the job until sp_add_jobserver is called, it is more efficient to call sp_add_jobserver last.
|
|
|
|
|