views:

20

answers:

1

Is it possible to post data from a SQL Server trigger to an external web page via POST or GET method?

For example, I want to post value of a field "BOOKID" on INSERT trigger to http://www.example.com/newbook.php?id=XXXXX

A: 

It is possible via an unsafe CLR assembly. With WebClient in it. And you'd want to call this CLR sproc in the said trigger. But, personally, it's an incredibly and amazingly bad idea.

Denis Valeev
If thats a "bad idea", then is it possible to pass that same information to a batch file or executable, which in turn will post it to the web page?
Abhijeet Pathak
It is also a very bad idea. You can set up a Service Broker paired to a .Net service (say, WCF) which in turn would do the job of communicating with the outside world. Or, you can insert notification data in a separate table and create a service with SqlDependency on that table and make RESTful calls from there to wherever you want.
Denis Valeev