May 20, 2010 at 12:33 am
how canwe take the script for multiple jobs in sql 2000?
May 20, 2010 at 11:47 am
Found this on this excellent forum. Try it. Thanks to author.
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Dim conServer
Dim fso
Dim iFile
Dim oJB
Dim strJob
Dim strFilename
Const ioModeAppend = 8
Set conServer = CreateObject("SQLDMO.SQLServer")
conServer.LoginSecure = True
conServer.Connect "WRITE servername(instancename) here"
strFilename = "C:\JOBS.sql"
For Each oJB In conServer.JobServer.Jobs
strJob = strJob & "--------------------------------------------------" & vbCrLf
strJob = strJob & "-- SCRIPTING JOB: " & oJB.Name & vbCrLf
strJob = strJob & "--------------------------------------------------" & vbCrLf
strJob = strJob & oJB.Script() & vbCrLf
Next
Set conServer = Nothing
Set fso = CreateObject("Scripting.FileSystemObject")
Set iFile = fso.CreateTextFile(strFilename, True)
iFile.Write (strJob)
iFile.Close
Set fso = Nothing
Main = DTSTaskExecResult_Success
End Function
Let us know if it workes for you!
May 20, 2010 at 11:52 am
If you're using Enterprise Manager, expand server, Management, SQL Server Agent, right-click on Jobs, select All Tasks, select Generate SQL Script...
If you're using SQL Server Management Studio, expand server, SQL Server Agent in Object Explorer; left-click on Jobs, highlight the jobs in the Object Explorere Details pane, right-click and select Script Job as...
Greg
May 20, 2010 at 11:54 am
Greg Charles (5/20/2010)
If you're using Enterprise Manager, expand server, Management, SQL Server Agent, right-click on Jobs, select All Tasks, select Generate SQL Script...If you're using SQL Server Management Studio, expand server, SQL Server Agent in Object Explorer; left-click on Jobs, highlight the jobs in the Object Explorere Details pane, right-click and select Script Job as...
This is a very straight forward method and the one that I would recommend. 😎
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply