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)
 Wondering the best way to do this

Author  Topic 

suppliesguys
Starting Member

2 Posts

Posted - 2007-02-19 : 16:31:16
Here is the problem that I am trying to solve. We currently have a mail order manager application that we use. We have several vendors that we have to initiate purchase orders with, and this is currently done manually. I am converting it to do the purchase orders through a webservice, but I would like this to complete in real time. I figured the best way to do this would be to initiate a trigger when the particular table has a record inserted. This insert triggers a script, passing the order number and verifies if a purchase order needs to be initiated based on what was ordered. If it does, it contacts the webservice, gets the appropriate data, then updates the appropriate tables with the new data, all through the script. I have been doing some research, and I have heard that triggers are simply best to be avoided, and calling outside scripts could be problematic too. However, I don't see any other way to do this.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-02-19 : 16:47:48
This is something you should do from a client application or a middle-tier. Any place but a trigger.




CODO ERGO SUM
Go to Top of Page

suppliesguys
Starting Member

2 Posts

Posted - 2007-02-19 : 16:50:51
I don't have access to the code of the application. It is an out of the box solution.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-02-19 : 17:27:48
quote:
Originally posted by suppliesguys

I don't have access to the code of the application. It is an out of the box solution.



That doesn't make doing that in a trigger a good idea.



CODO ERGO SUM
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-02-19 : 17:38:29
Well I could do it in a trigger!

Use the Trigger to insert a record in a "Batch" table.

Set up a scheduled task that interrogated the Batch Table and transfers any new records, via Web Service. Make sure that the Web Service is fail-safe.

P.S. I wish I had $1 for every real-time process that had been replaced with a Batch process because of its unreliability ...

We've using a Web Service at present to import some data.

So I ask: "How do you transfer 'What's Changed' since last time?"
"Oh that's easy, we transfer all the data which has changed in the last week every time"

</thud!>

Kristen
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-02-19 : 17:47:08
A real-time batch process?




CODO ERGO SUM
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-02-19 : 17:51:21
Ah! Now you've got me there ...
Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-02-20 : 23:05:44
quote:
P.S. I wish I had $1 for every real-time process that had been replaced with a Batch process because of its unreliability ...



Here, here! You should always plan on the "real time" connection being down, as Kristen said. Write your rows to a staging or batch table and send the info once a minute or once every 5 minutes or whatever.

--Jeff Moden
Go to Top of Page
   

- Advertisement -