Navi's

Necessity, the mother of invention

  • Visitor Map

    Locations of Site Visitors
  • Flag Counter

    free counters

Did you ever accidentally close SQL Server Management Studio?

Posted by Navi's on June 3, 2011


Did you ever accidentally close SQL Server Management Studio? And, in closing SSMS, did you get the prompt that says “Save changes to the following items?” And did you, completely unthinkingly, with a query you had just been working on, hit Cancel?

Try bellow query to get the executed query or procedure

 SELECT dest.text
 FROM sys.dm_exec_query_stats AS deqs 
 CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest 
 WHERE deqs.last_execution_time > '6/3/2011 07:00' 
       AND dest.text LIKE 'xyz%';

You can get back your query. But you have to do a little formatting work, but it was immediately available.

Reference:
http://bit.ly/k9xVBb

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: