LASTTRACE System Table Description

Description

A pseudo table. The LASTTRACE table presents statistics for all SQL and procedural operations executed on a connection. The statistics are available until another trace is started or the connection is closed.

  • LASTTRACE is populated only if tracing of statements and procedures on a connection is enabled using SET [CONNECTION] TRACE ON.

  • The table is available only on the connection that started the trace

Fields

Field Type Description

STATEMENT

bigint

ID of SQL statements executed during the trace

LINE

bigint

The line number of each operation executed by the statement. For regular SQL queries or DML there will be a single line only. Stored procedures, functions, and triggers may contain multiple lines.

CONNECTIONID

bigint

Connection ID of the connection used to execute the statement

EXECUTIONDEPTH

bigint

A stack depth count that increases when procedures call other procedures

TRACEDEPTH

bigint

Tracks the nesting of the operations within a procedure. This can be used to beautify the format of the text.

COUNT

bigint

The number of times this operation was executed in the statement

MINTIME

bigint

The minimum execution time for a line in the statement, in microseconds.

MAXTIME

bigint

The maximum execution time for a line in the statement, in microseconds.

TOTALTIME

bigint

The total execution time for all execution in a line in the statement, in microseconds.

TEXT

bigint

The SQL statement of procedure on the line

UPDATECOUNT

bigint

The total number of insert,update, or deletes that were performed by this statement.

Indexes

None