SELECT distinct dest.TEXT AS [Query],DB_NAME() as dbname,dess.host_name as 'Host Name',deqs.execution_count as count,deqs.creation_time as start_time,deqs.last_execution_time AS [last_execution_time] FROM sys.dm_exec_query_stats AS deqs CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest cross apply sys.dm_exec_sessions dess cross apply sys.objects so where dest.text like 's%' and dess.session_id = @@spid and so.type='U' ORDER BY deqs.last_execution_time DESC
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)