home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,976 of 19,505   
   Erland Sommarskog to JoeM   
   Re: Need example showing how to log DML    
   31 Dec 13 22:03:04   
   
   From: esquel@sommarskog.se   
      
   JoeM (noreply@replytogroup.com) writes:   
   > That's very useful information - thanks for posting that.  In   
   > the audit table, is there a way to include the actual DML   
   > (delete, or insert, or update) statement that was executed?   
   >   
      
   Yes and no. You can use the command DBCC INPUTBUFFER for this purpose, but   
      
   1) It requires high permissions, even for your own spid. This can be   
   addressed with certificate signing, but given the next points, I don't think   
   it's worth the hassle.   
      
   2) If the DML statement was executed inside a stored procedure, you will   
   only see the call to the stored procedure.   
      
   3) If the application uses parameterised statements (which it should), you   
   will only see the parameter names.   
      
      
      
   --   
   Erland Sommarskog, Stockholm, esquel@sommarskog.se   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca