C# Jadu
  • Home
  • Asp.net
  • Web Design
    • Html
    • Css
    • Java Script
  • Bootstrap
  • Sql
    • Queries
    • Stored Procedures
  • About Me
    • About Myself
    • My Projects
    • My CV
  • Gallery
  • Do you Know?

Friday, 20 November 2015

Last executed queries for a specific database

 Deepak Chaudhary     09:41     Queries     No comments   

Hi Friends...

sometimes we execute wrong query or unwanted queries in database If you want to change it so you can get these  last executed queries using the following SQL queries 


Your Queries are as under


1.      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

2.    SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*
       FROM sys.dm_exec_query_stats AS deqs
      CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
      WHERE dest.dbid = DB_ID('msdb')
      ORDER BY deqs.last_execution_time DESC


Thank You !
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Most Popular posts

  • How To Create Image wipe Effect With CSS3 Webkit Animation
    Hi Friends... In this article we learn how to create a Image wipe effect with CSS3. CSS transition and animations provide a way for web de...
  • CSS 3D Cube
    Hi Friends... CSS cubes really showcase what CSS has become over the years, evolving from simple color and dimension directives to a lang...
  • CSS 3D Transforms
    Hi Friends... There is nothing more flashy and full with eye-candy than an impressive 3D CSS demo. Although its utility outside of demos ...

About Me

Deepak Chaudhary
View my complete profile

Copyright © C# Jadu | Powered by Blogger
Design by Deepak Chaudhary