Recover queries after a SQL Server Management Studio (SSMS) crash or PC restart
Oct 25, 2011 4 Comments
There could be some instances when you have typed in that 500+ line stored procedure or formatted a query to your liking but didn’t save all that to a file. If the SQL Server Management Studio (SSMS) crashes for any reason before you could save your work, usually, the next time you start SSMS, it shows a dialog box as below to ask you if you’d like to recover the queries.
But sometimes it may not ask for recovery and it might seem that all the work is lost. Well, most of them (if not all) can still be recovered because the recovery dialog shows where are the backup files located.
On Windows XP, SSMS saves auto recover copies of queries as you work, in the folder -
C:\Documents and Settings\<user name>\My Documents\SQL Server Management Studio\Backup Files\Solution1
On Windows 7, the queries can be recovered from -
C:\Users\<user name>\Documents\SQL Server Management Studio\Backup Files\Solution1
The names of the auto saved files are bit cryptic so you might need to open all those files to find the one you are interested in.
Best practice -
- - Save your work frequently. This advice is good not just for web designers but software developers too!
- - Use a version control system