qua_recent_statements

Contents

qua_recent_statements#

Provides a list of recently executed SQL statements. Includes internally generated statements like default federator call-backs.

Column name

Data type

Nullable?

Description

id

guid

false

Statement id.

time

datetime2

false

Statement start date.

user

nvarchar(128)

true

User identity name.

sql_text

nvarchar(max)

true

SQL statement text with all parameters and their values.

status

nvarchar(128)

false

Statement status: Executing, Failure, or Success.

duration

time

false

Statement execution duration.

connection_id

smallint

false

Internal connection id.

error_message

nvarchar(max)

true

Error message, if execution resulted in an error.

Example#

Select 10 statements with the longest execution time:

select top(10)
       time, user, sql_text, status, duration, connection_id, error_message
  from sys.qua_recent_statements
 order
    by duration desc