Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I remotely trigger a DTS package?

Status
Not open for further replies.

jpittawa

Programmer
Oct 2, 2002
51
US
I have a DTS package that imports data for reporting. I would like to allow the user(s) to trigger the package from their desk without giving them Enterprise Manager.

The nature of their work does not lend itself to scheduling the package.

The server is SQL Server 7 on Windows 2000 Server.

What are my options?
 
jptttawa,

You have a number of options. You can save the DTS package to a .BAS file, and then include it in a VB project and compile it to an executable, which the user can invoke.

I use the following query statement (here, in ColdFusion) to create a self-destructing job that could possibly call a DTS package (this example runs an SP):

exec msdb.dbo.sp_add_job @job_name = 'myjob',
@enabled = 1,
@description = 'Do stuff for #ucase(l_user)#',
@delete_level = 3,
@notify_level_eventlog = 2,
@owner_login_name = 'login_name'
exec msdb.dbo.sp_add_jobstep @job_name = 'job_#ucase(l_user)#',
@step_name = 'dostuff',
@command = 'exec gensp_doStuff ''#ucase(l_user)#'', ''#dateformat(now(),"yyyy-mm-dd")#''',
@database_name = 'mydb',
@database_user_name = 'user_name'
exec msdb.dbo.sp_add_jobserver @job_name = 'job_#ucase(l_user)#'
exec msdb.dbo.sp_start_job @job_name = 'job_#ucase(l_user)#'

The @command step would have to be the GUID of the DTS package, which you can retrieve by scheduling the DTS from the interface, and reading the step details.

Wrap all of this in some sort of script or Web-based application, and you're good to go.

HTH,
PH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top