I have an audit routine sp which is triggered in my stored procs when they are run to record what is being requested by the clients.
I am wanting to record the Exec command the client is using, I have implemented the code below and if I run the code in management studio I get the correct result e.g.
Exec [IT].[UP_ReportUsageAudit] '05/01/2011', '05/01/2011', 'Select All', '1'
however when running from a client application the result is recored incorrectly e.g.
Corp_Rpt.IT.UP_ReportUsageAudit;1
What is the difference as to why I get differing results?
Code:DECLARE @sql varchar(100) DECLARE @command varchar(8000) CREATE TABLE #tmpGetBuffer ( EventType varchar(1000), Parameters varchar(6000), EventInfo varchar(8000) ) set @sql = 'dbcc inputbuffer('+ cast(@@spid as varchar(10)) + ')' insert into #tmpGetBuffer exec(@sql) SELECT @sql_handle = sql_handle FROM master.dbo.sysprocesses WHERE spid = @@SPID select * from #tmpgetbuffer select @command= eventinfo from #tmpgetbuffer IF @AuditID IS NOT NULL EXEC Common.UP_AuditEventUpdate @AuditID = @AuditID ,@Status = 'E' ,@Parameters = @strParameterDesc, @command = @command



Reply With Quote