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...
  • Interesting facts about India | Aware Talk
    1. Shampooing is an Indian concept Shampoo was invented in India, not the commercial liquid ones but the method by use of herbs. ...

About Me

Deepak Chaudhary
View my complete profile

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