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
 SQL Server Development (2000)
 DTS From a Stored Procidure

Author  Topic 

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-03-24 : 14:41:12
I have DTS package (SQL Server 2000 Through SQL Enterprise Manager) that does a number of Tasks and then performs a e-mail with several attachments to a remote.

The package works great and does all I ask. However I would like to be able to manually call it as a stored procedure from a front end application. Is this possible? And do I need to have it as a Meta DSP?

DST seems like a great tool for those of us who are better with GUI than Code. But if it can only be scheduled or run from the console it looses a lot of its appeal.


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-24 : 16:29:26
You really, really shouldn't do this, but:

You can call DTS from DTSRun.exe which can be executed via xp_cmdshell in a DTS package. The user who is executing the stored procedure must be granted xp_cmdshell permission though which is highly not recommended due to what xp_cmdshell allows a user to do on the SQL Server.

Tara
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-03-24 : 16:45:22
No I dont Think I want to open that Door. There must be another way or perhaps I need to just make a S.P. to do the whole think by itself.

Problem is I do not know how to Create a procidure to attach a stored .TXT and .CSV file to an e-mail and then send it.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-24 : 16:50:24
To send an e-mail in a stored procedure or even in Query Analyzer, just use the xp_sendmail stored procedure. xp_sendmail can send attachments.

Example:

CREATE PROC usp_JimL_Send_Email
AS
EXEC xp_sendmail @recipients = 'JimL@company.com',
@subject = 'Send Test.txt',
@message = 'Send Test.txt to JimL',
@attachments = 'C:\temp\Test.txt'

RETURN


Tara
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-03-24 : 16:55:28
This Looks Like It will work Fine. It was the only part I could not figure out.


Thank for the help

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-24 : 16:57:37
No problem at all. Let us know if you need help on other aspects of the stored procedure.

Tara
Go to Top of Page
   

- Advertisement -