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 2005 Forums
 Transact-SQL (2005)
 Triggered by a stored procedure

Author  Topic 

eddy556
Starting Member

36 Posts

Posted - 2009-01-27 : 11:06:09
I have a trigger set onto a table in a database - however it only seems to fire when manually editing the data using management studio and not when a stored procedure is run against the data.

This is the procedure:


USE [COSHH2008]
GO
/****** Object: Trigger [dbo].[KeepUpdated4] Script Date: 01/27/2009 15:47:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[KeepUpdated4] on [dbo].[Material]
FOR UPDATE, INSERT AS
UPDATE m
SET m.LastUpdate = GetDate()
FROM dbo.Material m
INNER JOIN inserted i
ON m.MTRLCODE =i.MTRLCODE
WHERE (m.KEYWORD<>i.KEYWORD
OR m.MATCON<>i.MATCON
OR m.HAZLEVEL<>i.HAZLEVEL
OR m.MDATE<>i.MDATE
OR m.SUPPCODE<>i.SUPPCODE
OR m.KEYCODE<>i.KEYCODE
OR m.SOLID<>i.SOLID
OR m.HAZSPEC<>i.HAZSPEC
OR m.LastUpdate IS NULL)

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-01-27 : 11:23:27
quote:
This is the procedure:

The code you posted is the trigger - not the SP

Try calling the procedure in SSMS, confirm the SP actuallly changed data in Material.

Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-27 : 12:00:51
is the stored procedure doing a bulk insert?
Go to Top of Page
   

- Advertisement -