SQL Server Performance

HowTo Log SQL Statements

Discussion in 'General Developer Questions' started by Itamar, May 30, 2003.

  1. Itamar New Member

    How can I log (to a table) the text of ALL SQL Statments fired against SQL Server ?
    (Similar to what profiler is doing but by using SP or custom application).
  2. gaurav_bindlish New Member

    Try creating a custom trace using the system stored procedures. Check in the previous posts in this forum how to manually create a trace. After you have done so, import the text file created by trace into SQL Server.

    See the Article

    INF: How to Create a SQL Server 2000 Trace (283790)
    This article describes how to create and use a stored procedure called trace_build that creates a trace from arguments in a text file. This stored procedure is an alternative to using SQL Profiler to create a script to create a trace.
    http://support.microsoft.com/default.aspx?scid=kb;en-us;283790

    HOW TO: Programmatically Load Trace Files into Tables (270599)
    In SQL Server 2000, system stored procedures are used to implement server-side tracing, but there is no way to programmatically trace directly to a table. However, you can easily import the trace file into a table by using the fn_trace_gettable...
    http://support.microsoft.com/default.aspx?scid=kb;en-us;270599

    HTH.

    Gaurav
  3. satya Moderator

Share This Page