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)
 Trigger Help!

Author  Topic 

sonic
Starting Member

11 Posts

Posted - 2001-03-06 : 15:32:53
Hey all! Thanx for reading this!

I have the following trigger on a rules table of mine...

ALTER TRIGGER tr_updateXMLRules ON rules_detail_com
FOR INSERT, UPDATE, DELETE
AS
SET NOCOUNT ON

DECLARE @ObjectID smallint
DECLARE ObjectCursor CURSOR FOR
SELECT DISTINCT rulc_fkObject FROM rules_control_com

OPEN ObjectCursor
FETCH NEXT FROM ObjectCursor INTO @ObjectID
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_xmlRules @ObjectID
FETCH NEXT FROM ObjectCursor INTO @ObjectID
END
CLOSE ObjectCursor
DEALLOCATE ObjectCursor

SET NOCOUNT OFF

What this basically does is fire a stored proc for each object in my control table (related to the original rules table). The stored proc just updates an XML file for each objects rules. The problem is that the stored proc creates and drops a temp table inside it and when used within the trigger I get a "DROP/CREATE TABLE statement cannot be executed within a trigger".

Does anyone know of a way around this or have encountered this before?

Thanx for all your help!


J'son
   

- Advertisement -