Menemukan Query yang dieksekusi

sedang asik asik “nguery”

ketik ketik cantik panjang, tekan f5 di SQL Server Management Studio (SSMS) ,

copy hasil ke excel

lalu klik close window di SSMS , wew lupa save query panjang itu !!

jangan keburu panik dan bunuh diri…

kembali ke SSMS anda, dan jalankan query :


SELECT dest.TEXT AS [Query],
deqs.execution_count [Count],
deqs.last_execution_time AS [Time]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC

alhasil query kita masih dapat dikembalikan lagi ..
wew leganya…

Leave a Reply

Your email address will not be published. Required fields are marked *