Databases Reference
In-Depth Information
The parameter @TraceFile specifies the location and file name where the trace file
should be saved. @TraceID is the output variable and the returned ID value of the trace
will be stored in this variable. If the stored procedure can create a trace file successfully, it
returns 0 that gets stored in variable @ReturnCode .
Remember that all SQL Trace system stored procedures are strictly typed. By
saying strictly typed, it means that the data types of the parameters that you
pass to these stored procedures must match exactly with the data types of
stored procedures' parameter definition. So, you cannot pass a parameter of
type INT when BIGINT is required.
If trace is created successfully and @ReturnCode is zero, then we add event classes and
data columns by calling stored procedure sp_trace_setevent for each combination of
event class and data column one-by-one for following event classes and data columns:
F DataFileAutoGrow event class and DatabaseName data column
F DataFileAutoGrow event class and FileName data column
F DataFileAutoGrow event class and StartTime data column
F DataFileAutoGrow event class and EndTime data column
F LogFileAutoGrow event class and DatabaseName data column
F LogFileAutoGrow event class and FileName data column
F LogFileAutoGrow event class and StartTime data column
F LogFileAutoGrow event class and EndTime data column
Stored procedure accepts the following parameters:
F @traceid
F @eventid
F @columnid
F @on
@TraceID is the ID of the trace we add event classes and data columns to.
Note that every event classes and data columns have their associated event IDs and column
IDs. We have to pass these ID values corresponding to event classes and data columns
that we want to include in our trace. These values are passed by appropriate variables
declared for each event class and data column. For example, for DataFileAutoGrow
event class and FileName data column we have stored their appropriate ID values in
@Event_DataFileAutoGrow and @DataColumn_FileName variables respectively.
 
Search WWH ::




Custom Search