Recover unsaved SQL query scripts

前端 未结 14 1575
旧巷少年郎
旧巷少年郎 2020-12-07 06:55

How to recover the unsaved scripts if the SSMS crashes / unsaved tab gets accidentally closed?

相关标签:
14条回答
  • 2020-12-07 07:15

    A bit late to the party, but none of the previously mentioned locations worked for me - for some reason the back up/autorecovery files were saved under VS15 folder on my PC (this is for SQL Server 2016 Management Studio)

    C:\Users\YOURUSERNAME\Documents\Visual Studio 2015\Backup Files\Solution1

    You might want to check your Tools-Options-Environment-Import and Export Settings, the location of the settings files could point you to your back up folder - I would never have looked under the VS15 folder for this.

    0 讨论(0)
  • 2020-12-07 07:18

    Maybe you don't find the suggested directories or your recovery file is missing, thanks god I replicated the crash with an unsaved script and lead me to this directory:

    C:\Users\user\OneDrive\Documents\Visual Studio 2015\Backup Files\Solution1

    So, maybe this saves your day :)

    0 讨论(0)
  • 2020-12-07 07:18

    For SSMS 18, I found the files at:

    C:\Users\YourUserName\Documents\Visual Studio 2017\Backup Files\Solution1
    

    For SSMS 17, It was used to be at:

    C:\Users\YourUserName\Documents\Visual Studio 2015\Backup Files\Solution1
    
    0 讨论(0)
  • 2020-12-07 07:20

    Use the following location where you can find all ~AutoRecover.~vs*.sql (autorecovery files):

    C:\Users\<YourUserName>\Documents\SQL Server Management Studio\Backup Files\Solution1
    
    0 讨论(0)
  • 2020-12-07 07:22

    For SSMS 18 (specifically 18.6), I found my backup here C:\Windows\SysWOW64\Visual Studio 2017\Backup Files\Solution1.

    Kudos to Matthew Lock for giving me the idea to just search across my whole machine!

    0 讨论(0)
  • 2020-12-07 07:25

    You may be able to find them in one of these locations (depending on the version of Windows you are using).

    Windows XP

    C:\Documents and Settings\YourUsername\My Documents\SQL Server Management Studio\Backup Files\
    

    Windows Vista/7/10

    %USERPROFILE%\Documents\SQL Server Management Studio\Backup Files
    

    OR

    %USERPROFILE%\AppData\Local\Temp
    

    Googled from this source and this source.

    0 讨论(0)
提交回复
热议问题