Re: Trigger a .EXE from SQL Server



Jon,

In your trigger, provided that it is enabled for non-sysadmin use, you can
use the xp_cmdshell procedure to issue an operating system command line
statement. This will, of course, cause a small delay in the completion of
your insert statement. (But xp_cmdshell has security issues.)

If you can stand a minute or two of asynchronous delay you might do
something like the following.
1. Create a SQL Agent job to run the EXE.
2. Post enough data in the inserted table or in another table if necessary
to describe with directories still need to be created.
3. From your trigger issue an sp_start_job 'jobname'

This will run asynchronously from the trigger, allowing the trigger to
complete. If you are using SQL Server 2005 you can grant the job the needed
security context using a SQL Agent proxy account.

RLF
"Jon Rowlan" <jon.rowlan@xxxxxxxx> wrote in message
news:O61bdrmqHHA.4132@xxxxxxxxxxxxxxxxxxxxxxx
Is it possible to trigger a .EXE program to run on a Row insertion ...

I want to run an .EXE program whenever a new row is inserted to create a
directory somewhere on the server.

I know that there are triggers that I can use but these seem to be to
execute SQL statements ...

many thanks all,

jON




.



Relevant Pages

  • Re: Trigger a .EXE from SQL Server
    ... Running out of process actions like the file system creation is discouraged in a trigger. ... A better method, would be to execute the insert through a stored procedure, with the directory creation and the insert being called in some order. ... In your trigger, provided that it is enabled for non-sysadmin use, you can use the xp_cmdshell procedure to issue an operating system command line statement. ... If you are using SQL Server 2005 you can grant the job the needed security context using a SQL Agent proxy account. ...
    (microsoft.public.sqlserver.connect)
  • Re: Records not inserting...
    ... > I am totally new to SQL server. ... However, in a trigger, would I be ... test the effects of certain data modifications and to set conditions for ... UPDATE statements. ...
    (microsoft.public.sqlserver.odbc)
  • Re: Help for an Oracle Newbie
    ... application I wrote using SQL Server ported over to Oracle. ... Obviously there are several built in data types in SQL Server that do ... Of course I had to use a different name for the trigger under each ...
    (comp.databases.oracle.server)
  • Re: TRIGGER (AFTER INSERT) and Store Procedure ... insert failed !
    ... >into SQL server, the record exist anyway! ... >If you refresh the data you will see the record... ... it gets refreshed after trigger excecution automatically. ... I don't know your monitoring system, but I guess that removing the result ...
    (microsoft.public.sqlserver.programming)
  • Re: Access Bug with SQL Server identity columns
    ... Even though SQL Server since version 2000 has had a reliable ... The work-around I've always used is to make sure that no trigger inserts into ... a table that contains an IDENTITY column, and use some other unique identifier ... >create a form on table1 with a subform on table2. ...
    (comp.databases.ms-access)

Loading