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)
 Run DTS from ASP Page (and pass variables)

Author  Topic 

Mannga
Yak Posting Veteran

70 Posts

Posted - 2002-09-17 : 09:32:56
Hi All,

I have a DTS package which is now working 100% but I would like to run this package from a ASP or ASP.NET page.

Is this possible?
If it is I would also like to pass a filename to the DTS package, how would I go about this?

Thanks,
Gavin

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-09-17 : 09:45:16
quote:
Is this possible

Yes, lookup DTSRun.exe in Book Online
quote:
...pass a filename...

SQL 2K's version of DTSRun.exe allows you to pass in parameters ...

Jay White
{0}
Go to Top of Page

Mannga
Yak Posting Veteran

70 Posts

Posted - 2002-09-17 : 09:50:48
So all I need to actually find out is how to run .exe files from an ASP page?

I am running SQL7, is it still possible to pass parameters?

Thanks,
Gavin

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-09-17 : 10:03:33
IMHO it would be better to create a job that runs the DTS package with dtsrun...you can right-click the package in Enterprise Manager and choose "Schedule Package" and it will do the work for you. You can set a scheduled run time and then edit the package to removed the job schedule afterwards. Then you can call the job from an ASP page using sp_start_job. Books Online has more info on this.

As far as passing parameters, that would be a little tricky to do (I think, never tried it) but it would help to know what the parameters are for. File names? Table names? Any detail you can provide would help, there might be another way to do this without parameters, or some other way to pass them.

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-09-17 : 10:14:07
Hey Rob,
quote:
If it is I would also like to pass a filename to the DTS package
...

I agree with Rob, the best thing to do is schedule a job. However, sometimes you need to start a DTS from a web page. The best option here is to create a unscheduled job and use sp_start_job from a proc. OR, if you have xp_cmdshell still exposed, you can run that from a proc.

sqldts.com has an article that may be of interest to you ...

Jay White
{0}
Go to Top of Page

Mannga
Yak Posting Veteran

70 Posts

Posted - 2002-09-17 : 10:15:06
Okay well here is my story

I have a DTS package that picks up information from a .txt file and populates my SQL database from it.

I have created an .asp page that people use to upload there text files, each file has a specific naming order which is checked by the .asp page.

What I would like is once the file has been uploaded to change the filename in my DTS "Text File (Source)" to whatever the filename that was just uploaded and then to run the DTS package.

I have thought about running the DTS package through Scheduler but the 2 problems I ran into where
1. How do I change the filename in the "Text File (Source)"
2. How do I stop it running the same files night after night as these files cannot be deleted or moved at the end of the DTS package.

Any help you can give would be great because I am doing all of this manually at the moment and it is boring

Cheers,
Gavin

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-09-17 : 10:28:09
I am hoping that you didn't see my post until after you dropped your last ... the SQLDTS article is your key to the castle ...

Jay White
{0}
Go to Top of Page
   

- Advertisement -