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
 General SQL Server Forums
 New to SQL Server Programming
 Total Newbie

Author  Topic 

darren2170
Starting Member

2 Posts

Posted - 2008-03-26 : 14:35:08
I just installed SQL Server 2005 express. I have full rights, and enabled XP_CMDSHELL...

Here's my Trigger:

USE [JobCost]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[start_jobcost]
ON [dbo].[TJC]
AFTER INSERT
AS
EXEC master..xp_cmdshell 'C:\jobCost.exe'


This Trigger saves successfully but the trigger won't run when I append a record to the table (TJC) using access query. Is there something else I'm missing...do I need to enable the trigger function?

please help

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-26 : 14:37:43
Have you enabled xp_cmdshell?
The roew will be locked for the duration of the trigger so jobCost.exe won't be able to access it - it will hang.

Whatever you are trying to do this is almost certainly a very bad way of attempting it.

==========================================
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

darren2170
Starting Member

2 Posts

Posted - 2008-03-26 : 14:49:51
xp_cmdshell is enabled and jobcost.exe never starts... its only one record that gets inserted.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-26 : 14:56:28
Are you sure?
Does your insert complete?

Try creating a dummy table
create table trace (i int, d datetime)
then change the trigger to
insert trace (i,d) select 1, getdate()

Still think what you are doing is a going to cause problems even if you get it working.

==========================================
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 -