Sunday, March 11, 2012

Auditing Question

Suppose I would like to mimic SQL Profiler. That is I would like to capture
every sql statement issued to my SQL Server.
What are my options? Obviously I could find a log reader and read
update,insert or delete statements but I would like to capture exec and
select statements too. I would like to capture all T-SQL statements just as
SQL Profiler does. Can I do this?You can start a trace using system procedures as well (Profiler is actually
client-side tool that uses those traces). Check the sp_trace* procedures.
Note that you can create a trace with Profiler and then save it as a script
as well, so you don't have to do the programming part.
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"JI" <anonymous@.discussions.microsoft.com> wrote in message
news:uT6IDt$GEHA.2576@.TK2MSFTNGP11.phx.gbl...
> Suppose I would like to mimic SQL Profiler. That is I would like to
capture
> every sql statement issued to my SQL Server.
> What are my options? Obviously I could find a log reader and read
> update,insert or delete statements but I would like to capture exec and
> select statements too. I would like to capture all T-SQL statements just
as
> SQL Profiler does. Can I do this?
>
>

No comments:

Post a Comment