• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 610
  • Last Modified:

How to know last Query in SQL Server

Hi Guys,

How to know the last Insert and Update Query that was executed in SQL Server?

Please help. Thanks
0
softbless
Asked:
softbless
2 Solutions
 
antonybrahinCommented:
use the below
SELECT deqs.last_execution_time AS [Time], dest.text AS [Query]
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

Open in new window

0
 
softblessAuthor Commented:
thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now