Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Execute xp_cmdshell from trigger fails ?

Author  Topic 

nabaolao
Starting Member

1 Post

Posted - 2004-05-03 : 11:20:15
I am able to execute the following exe from Query Analyzer,

EXEC master..xp_cmdshell 'C:\Program.exe \PARAM'

When I execute this same exe from a trigger, the process seems to hang. At this point I am not able to update the trigger or stop the process Program.exe.

Am I running into permission errors while running within a trigger? The exe builds some xml, updates some tables, and sends off email.

Is there a better way of going about the following process?

1. Order comes through system
2. Order Processing and updates happen in DB
3. When processesing complete and status is correct, execute an exe file (takes care of integration with accounting software)

Any help would be appreciated. Thanks...

nr
SQLTeam MVY

12543 Posts

Posted - 2004-05-03 : 11:35:14
Suspect it is because the trigger runs in a transaction so tables will be locked. The exe will connect on another spid and so if it tries to update the same tables it could be blocked.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -