I have run a query a few days before but its lost now I did not save it can you please help me whether we can find the last run query in sql server managament studio.
Asked
Active
Viewed 1.7k times
4
-
If SQL Server hasn't been restarted, you may be able to find the query in the plan cache. [Since I noticed the duplicate, I transferred my answer there](http://stackoverflow.com/a/18018743/61305). – Aaron Bertrand Aug 02 '13 at 13:54
1 Answers
3
I suggest using SSMS Tools in the future.
Among several other features, it also keeps a history of queries run.

Gidil
- 4,137
- 2
- 34
- 50