Recover unsaved SQL query scripts

前端 未结 14 1572
旧巷少年郎
旧巷少年郎 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:25

    I know this is an old thread but for anyone looking to retrieve a script after ssms crashes do the following

    1. Open Local Disk (C):
    2. Open users Folder
    3. Find the folder relevant for your username and open it
    4. Click the Documents file
    5. Click the Visual Studio folder or click Backup Files Folder if visible
    6. Click the Backup Files Folder
    7. Open Solution1 Folder
    8. Any recovered temporary files will be here. The files will end with vs followed by a number such as vs9E61
    9. Open the files and check for your lost code. Hope that helps. Those exact steps have just worked for me. im using Sql server Express 2017
    0 讨论(0)
  • 2020-12-07 07:32

    Go to SSMS >> Tools >> Options >> Environment >> AutoRecover

    There are two different settings:

    1) Save AutoRecover Information Every Minutes

    This option will save the SQL Query file at certain interval. Set this option to minimum value possible to avoid loss. If you have set this value to 5, in the worst possible case, you can lose last 5 minutes of the work.

    2) Keep AutoRecover Information for Days

    This option will preserve the AutoRecovery information for specified days. Though, I suggest in case of accident open SQL Server Management Studio right away and recover your file. Do not procrastinate this important task for future dates.

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