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
 Transact-SQL (2000)
 AUDIT TRAIL

Author  Topic 

Da_Retina
Posting Yak Master

109 Posts

Posted - 2001-09-23 : 06:32:55
HI..I am sorry that I am still at the same point..but I am in real trouble.
I have the following statement in an audit trail trigger :
-----------------------------------------
EXECUTE Dropper @DelTable='TmpDeleted', @InsTable='TmptInserted'
Where Dropper is a stored procedure ,its code follows:
CREATE PROCEDURE Dropper (@DelTable nchar(35),@InsTable nchar(35) ) AS
DECLARE @DropDel nchar(400)
DECLARE @DropIns nchar(400)
IF EXISTS (SELECT name FROM sysobjects WHERE name =@DelRndTable AND type = 'U')
BEGIN
SET @DropDel = 'DROP TABLE ' + @DelTable
EXECUTE sp_executesql @DropDel
END
IF EXISTS (SELECT name FROM sysobjects WHERE name = @InsTable AND type = 'U')
BEGIN
SET @DropIns = 'DROP TABLE ' + @InsRndTable
EXECUTE sp_executesql @DropIns
END
------------------------------------------
This is the code...it is simply not working!!!..by debugging it seems that it I CAN NOT DROP A TABLE from a TRIGGER even if I WENT OUT OF SCOPE into a DYNAMIC STATEMENT or TO A STORED PROCEDURE and THEN INTO A DYNAMIC STATEMENT!..IS THIS CORRECT??
THANKS A BUNCH FOR ANY HELP!!!!!!!!!!!!!!!!
I really NEED it..
-------------------------
I will pull the trigger!!!

   

- Advertisement -