Query below shows last queries executed by specific user.
Table containing query log retain them approximately for 2-5 days then they are removed.
select usename as username, database, querytxt as query, starttime, endtime, case aborted when 1 then 'YES' else 'NO' end as aborted from stl_query ql join svl_user_info us on ql.userid = us.usesysid where usename = 'dataedo' -- put username here order by starttime desc;
- username - name of user who executed query
- database - name of database in which query was executed
- query - query text
- starttime - start time of a query
- endtime - end time of a query
- aborted - indicate wheter query was aborted
- One row represents one query executed by specific user
- Scope of rows: all queries saved in log for provided user
- Ordered by start time of query