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)
 a trigger that starts a dts package

Author  Topic 

neojapanese
Starting Member

13 Posts

Posted - 2006-01-13 : 06:10:07
i know you can sceduale a dts package to download data.
but I want a dts package to download evertime someone enters a recorde into a table.

anyone have any sample code on this?

here is the overview on what i am doing.
i have a school website where people pay for classes. the student information gets send to a sql server backend (located where the website is hosted).
now i need to get that record to down load to the sql server at the school everytime a new student pays for class.

anyone have a sample on this?

szgldt
Starting Member

10 Posts

Posted - 2006-01-13 : 10:04:30
Could you not create a stored procedure to run the DTS package using the DTSRUN utility command? (This is explained in book online)

Then call the stored procedure using the EXEC command from the trigger.

Another option would be to write TSQL statements to do the job of your DTS package. For example if your DTS package is just inserting records into a table then maybe you could write an INSERT TSql statement instead. This would probably be a cleaner solution than continually calling a DTS package.
Go to Top of Page

neojapanese
Starting Member

13 Posts

Posted - 2006-01-13 : 10:11:38
thank you very much! I dont know much. just started with sql server.I have to converted access database to sql server. I think I will give up sleeping this year.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-01-13 : 10:15:25
Launching a process from a trigger is a very bad idea. I'm not sure if szgldt's idea is the same as this but perhaps the trigger could simply add a row to a "dtsQueue" table. Then have a job that runs every few seconds to process all rows in the queue.

My only point is you don't want a student's payment transaction to hang or rollback because the external process had a problem.

Be One with the Optimizer
TG
Go to Top of Page

neojapanese
Starting Member

13 Posts

Posted - 2006-01-13 : 11:22:39
thats a really good idea! i didnt think of that. so when a student puts the info in the table. make a copy of the rec to a "dtsQueue" table. have dts download every (5 min?)
I should delete the rec from the "dtsQueue" so i dont have dub records?

can someone learn sql server alone or should one take a class?
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-01-13 : 11:50:26
I would add columns to track things of importance to you like status. Only process rows that have not been processed. That way you also have a record of what has happened and when. Also if problems occur there is a record of that. Seperate log files can also be used for more detailed auditing.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -