Reputation: 44225
I have SSMS 2014 running with queries I am working on. When the computer got reset or when I kill SSMS, there are no autorecover files and when SSMS starts, it doesn't ask if I want to recover any files. I have autorecover set to save every minute. I have checked the paths mentioned here. I don't know why it's not working. Any free SSMS add-ons which provides this feature? (SSMS Tools Pack is not free)
Upvotes: 1
Views: 844
Reputation: 119
Using SSMS 2016 I found that the autorecover HAD saved my files - not sure of frequency or convinced by the coverage, but in my case it had saved what I wanted.
I found the location by nosing around in the registry, for me the location was stored in a key here:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\SQL Server Management Studio\13.0\NewProjectDialog\MRUSettingsLocalProjectLocationEntries
My location was in My Documents\Visual Studio 2015, but I presume that will be different if you don't have VS installed!
Update:
There is a comment on this post which provides code to retrieve recently run queries.
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
Works a treat and there is enough there for you to filter and find any lost queries, although this is obviously a last resort solution and best suited to recovery just after the loss. Also, the queries won't be preserved over a SQL server restart.
Upvotes: 1
Reputation: 5909
SSMS Tools Pack is pretty inexpensive so shouldn't be discounted. SSMSBoost is free and has a Recent Tabs feature.
Red Gate (who I work for) has SQL Prompt, which benefits from a Tab History feature. This is a commercial collection of a huge number of productivity features.
Upvotes: 0