Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Posts
    36

    Unanswered: Calling External App From Sproc or Trigger?

    Hi all. Yes, it's me again. LOL

    My question is this: Can I program something in the way of a trigger or a sproc that when a certain field is populated (on insert/update) that it calls a VB application or some other external program (possibly a web app?)

    If not, does anyone have any suggestions on how I might accomplish this for SQL7? We have actually begun testing to upgrade our 7DBs to 2K, so if it's possible to do something like this in 2K that will also work for me.

    Thanks for all the help you guys provide me! I need every bit of it sometimes!

    Dirk

  2. #2
    Radzi Guest

    Re: Calling External App From Sproc or Trigger?

    use xp_cmdshell in your trigger.



    "tnjazzgrass" wrote in message
    news:2430444.1043362868@dbforums.com...
      > Hi all. Yes, it's me again. LOL
      > My question is this: Can I program something in the way of a trigger
      > or a sproc that when a certain field is populated (on insert/update)
      > that it calls a VB application or some other external program (possibly
      > a web app?)
      > If not, does anyone have any suggestions on how I might accomplish
      > this for SQL7? We have actually begun testing to upgrade our 7DBs to
      > 2K, so if it's possible to do something like this in 2K that will also
      > work for me.
      > Thanks for all the help you guys provide me! I need every bit of it
      > sometimes!
      > Dirk
      > --
      > Posted via http://dbforums.com

  3. #3
    Join Date
    Jan 2003
    Location
    London, England
    Posts
    106
    As Radzi says you should use the system extended sored procedure xp_cmdshell within a trigger. Something like this will do the trick:

    Code:
    CREATE  TRIGGER tr_myTrigger ON dbo.myTable 
    FOR INSERT, UPDATE, DELETE
    AS
    
    DECLARE @Cmd varchar(1000)
    BEGIN 
      SET @Cmd = 'c:\..\program.exe'
      EXEC master..xp_cmdshell @Cmd, NO_OUTPUT
    END
    Cheers!
    Frettmaestro
    "Real programmers don't document, if it was hard to write it should be hard to understand!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •