ousoonerjoe
Programmer
I've recently learned about the existence of the DBCC calls. From what I am discovering, this has great use in Audit trails. What I am running into, is being able to push the output to a table. Ideally, I just need the 'EventInfo' field, but will take all and work with it as needed. Here's a couple samples of what i've been trying to pull off:
Any assistance is welcome.
Thank you.
--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
Code:
DECLARE @Id INT;
DECLARE @Et VARCHAR(50);
DECLARE @Parms INT;
DECLARE @T VARCHAR(8000);
SET @Id = (SELECT @@SPID);
DECLARE Curse CURSOR FOR DBCC INPUTBUFFER (@Id)
OPEN Curse
FETCH NEXT FROM Curse INTO @Et, @Parms, @T
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO TestAudit(EventType, Params, EventInfo)
VALUES (@Et, @Parms, @T)
FETCH NEXT FROM Curse INTO @Et, @Parms, @T
END
CLOSE Curse;
DEALLOCATE Curse;
[i]Something like this is out too:[/i]
DECLARE @Id INT;
SET @Id = (SELECT @@SPID);
SELECT (DBCC INPUTBUFFER (@Id)) INTO TestAudit
Thank you.
--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------