|
From: Mufasa on 17 Jul 2008 08:47 Anybody know of a script that generate all of the jobs for SQL Agent? TIA - Jeff.
From: Mufasa on 17 Jul 2008 08:58 BTW - I forgot to mention - I want to do ALL jobs. I know I can do them individually through Ent Manager. "Mufasa" <jb(a)nowhere.com> wrote in message news:%23dLbTtA6IHA.4560(a)TK2MSFTNGP04.phx.gbl... > Anybody know of a script that generate all of the jobs for SQL Agent? > > TIA - Jeff. > >
From: Paddy on 17 Jul 2008 09:04 On 17 Jul, 13:47, "Mufasa" <j...(a)nowhere.com> wrote: > Anybody know of a script that generate all of the jobs for SQL Agent? > > TIA - Jeff. Jeff sp_add_job [ @job_name = ] 'job_name' [ , [ @enabled = ] enabled ] [ , [ @description = ] 'description' ] [ , [ @start_step_id = ] step_id ] [ , [ @category_name = ] 'category' ] [ , [ @category_id = ] category_id ] [ , [ @owner_login_name = ] 'login' ] [ , [ @notify_level_eventlog = ] eventlog_level ] [ , [ @notify_level_email = ] email_level ] [ , [ @notify_level_netsend = ] netsend_level ] [ , [ @notify_level_page = ] page_level ] [ , [ @notify_email_operator_name = ] 'email_name' ] [ , [ @notify_netsend_operator_name = ] 'netsend_name' ] [ , [ @notify_page_operator_name = ] 'page_name' ] [ , [ @delete_level = ] delete_level ] [ , [ @job_id = ] job_id OUTPUT ] Paddy
From: Uri Dimant on 17 Jul 2008 09:06 Mustafa ' Use oServer to connect to the appropriate SQL Server. Dim oServer AS New SQLDMO.SQLServer ' Server object Dim oJob AS SQLDMO.Job ' Holds each job object Dim myOutFile AS Integer ' Holds file handle 'Connect to the server using trusted authentication. oServer.LoginSecure = True oServer.Connect ("(local)") ' Change if required ' Should check oServer.Status 'Open up an output file and write header line. myOutFile = FreeFile Open "C:\ALLJOBS.SQL" FOR Output Shared AS #myOutFile ' Change if required Print #myOutFile, "-- Start of SQL to recreate all jobs" + vbCr ' Iterate through all the jobs; get name or script. FOR Each oJob IN oServer.JobServer.Jobs ' Print #myOutFile, oJob.Name ' Get job name only and send to file. Print #myOutFile, oJob.Script ' Get CREATE script and send to file. NEXT 'Closing comment in file Print #myOutFile, "-- End of SQL to recreate all jobs" + vbCr ' Clean up Set oServer = Nothing Close #myOutFile ' End of code to paste "Mufasa" <jb(a)nowhere.com> wrote in message news:%23dLbTtA6IHA.4560(a)TK2MSFTNGP04.phx.gbl... > Anybody know of a script that generate all of the jobs for SQL Agent? > > TIA - Jeff. > >
From: Mufasa on 17 Jul 2008 09:15 Is there DMO to do this? I'd rather not do VBScript. "Uri Dimant" <urid(a)iscar.co.il> wrote in message news:Ol0A92A6IHA.4468(a)TK2MSFTNGP02.phx.gbl... > Mustafa > > > ' Use oServer to connect to the appropriate SQL Server. > Dim oServer AS New SQLDMO.SQLServer ' Server object > Dim oJob AS SQLDMO.Job ' Holds each job object > Dim myOutFile AS Integer ' Holds file > handle > > 'Connect to the server using trusted authentication. > oServer.LoginSecure = True > oServer.Connect ("(local)") ' Change if > required > ' Should check oServer.Status > > 'Open up an output file and write header line. > myOutFile = FreeFile > Open "C:\ALLJOBS.SQL" FOR Output Shared AS #myOutFile ' Change if required > Print #myOutFile, "-- Start of SQL to recreate all jobs" + vbCr > > ' Iterate through all the jobs; get name or script. > > FOR Each oJob IN oServer.JobServer.Jobs > ' Print #myOutFile, oJob.Name ' Get job name > only and send to file. > Print #myOutFile, oJob.Script ' Get CREATE > script and send to file. > > NEXT > > 'Closing comment in file > Print #myOutFile, "-- End of SQL to recreate all jobs" + vbCr > > ' Clean up > Set oServer = Nothing > Close #myOutFile > > ' End of code to paste > "Mufasa" <jb(a)nowhere.com> wrote in message > news:%23dLbTtA6IHA.4560(a)TK2MSFTNGP04.phx.gbl... >> Anybody know of a script that generate all of the jobs for SQL Agent? >> >> TIA - Jeff. >> >> > >
|
Next
|
Last
Pages: 1 2 Prev: Sql question Next: view seems to ignore the 'concat null yields null' option |