[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

SQL Trigger to HTTP POST

I need to write a MS SQL 2000 Db trigger to do the following but I am new to SQL and have very little experience...

What I need to do is on the insert of any data to a table called docs I need to check the Name of the document contains a certain string of characters e.g Council Minutes etc etc
If it does then i need to extract some further info from a series of fields Folder,Leaf, and a binary field which actually contains the document.
I then need to send these to an HTTP server via an HTTP POST command.

Any thoughts greatly appreciated as I know nothing about this
0
richarddanks
Asked:
richarddanks
  • 3
  • 3
1 Solution
 
Brian CroweDatabase AdministratorCommented:
A trigger can return a result set...I am unfamiliar with the HTTP POST command however
0
 
richarddanksAuthor Commented:
sorry I think that I need to add the result to a set of variables then send out the sesults in the format of an http post url

e.g. http://serverfqdn.com/docname=12&Leaf=folder etc etc
thenks for the comment though
0
 
richarddanksAuthor Commented:
So Far Ithink what I need is

CREATE TRIGGER tr_agendapost
ON docs
FOR INSERT
AS
DEFINE @docname varchar(256)
DEFINE @leafname varchar(256)
DEFINE @document bin(1024)

SELECT @docname=docname FROM inserted
WHERE docname LIKE ('council%')

but I'm not sure this will a) give me the desired results or b) where to go from here to get the results in to a set of variables and then push those results to a webserver...

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
richarddanksAuthor Commented:
Also this needs to process multiple INSERTS to the DB
0
 
Brian CroweDatabase AdministratorCommented:
CREATE TRIGGER tr_agendapost
ON docs
AFTER INSERT
AS
BEGIN
IF inserted.docname LIKE ('council%')
     SELECT docname, leafname, document FROM inserted
END
0
 
Brian CroweDatabase AdministratorCommented:
correction...

CREATE TRIGGER tr_agendapost
ON docs
AFTER INSERT
AS
BEGIN
IF EXISTS (SELECT * FROM inserted WHERE docname LIKE ('council%'))
     SELECT docname, leafname, document FROM inserted
END
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now