qua_recent_statements#

Provides a list of recent SQL statements that were received and handled by the Engine. 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.

status

nvarchar(128)

true

Statement status: Executing, Error, or Success.

duration

time

true

Statement duration.

connection_id

smallint

true

Internal connection id.

Example#

Select 10 statements with the longest execution time:

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