Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Execute Jobs in SQL Server Agent using VB Script

Author  Topic 

cheechwan
Starting Member

11 Posts

Posted - 2006-07-30 : 21:17:04
Dear Experts,

Hi, i do have a jobs in MS SQL Server 2000t, i have would like to start the Jobs using VB 6 scripting without schedule from the ms sql server agent.

Does anyone know how to use the VB6 script to start the jobs in MS SQL Server Agent?

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-07-30 : 21:44:54
You should be able to do it using the SQLDMO API

I don't have any code samples, but from past experience it's quite intuitive. I would normally write the script in VB IDE, get it working and then translate into VBScript (basically the same thing, but change all the instantiation code to use CreateObject)

Go to Top of Page

cheechwan
Starting Member

11 Posts

Posted - 2006-07-31 : 03:29:29
HI Timmy,

Thanks for your clue and guide, i got the solutions on how to start the available jobs in MS SQL Server.

Below here are the solutions that im currently using:

Add Project Reference to Microsoft SQLDMO OBJECT LIBRARY

Dim oServer As New SQLDMO.SQLServer
oServer.LoginSecure = False 'SQL Security
oServer.Connect "SQLServer", "SQLServerUserID", "SQLServerPwd" 'SQL Server Login

oServer.JobServer.Jobs("Job in SQL Server").Start 'assigned the jobs name and start SQL jobs
oServer.DisConnect
Set oServer = Nothing

Go to Top of Page
   

- Advertisement -