Locking up on Trigger call

  • Hello all.

    I've been tasked with creating a flat-file based upon database events that occur in a legacy system.

    I've written an application that is a command-line .exe using MFC. Its job is simple. When an insert occurs in a given table, I'm trying to execute the .exe.

    Here is my trigger code:

    CREATE TRIGGER trg_CallFileBuilder

    ON dbo.SomeTable

    AFTER UPDATE

    AS

    EXEC master..xp_cmdshell 'start C:\FileBuilder.exe', NO_OUTPUT

    Now, the executable (FileBuilder.exe) does a query on SomeTable. I don't care what's updated. I simply want the FileBuilder to do its thing.

    But it locks up when I 'update SomeTable', causing me to have to start and stop the SQL service. When I run FileBuilder.exe by itself (say from the command line), it runs and produces results as expected.

    Can someone tell this SQL idiot (me) what I'm doing wrong?

    Thanks!

  • You can monitor the locks on sometable by sp_lock.

    Depending on the situation you could move EXEC master..xp_cmdshell 'start C:\FileBuilder.exe', NO_OUTPUT to an sqlserver-job and start it fom your trigger.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply