Reputation: 47402
Whenever I open up SSMS (SQL Server 2012), I get all of the scripts that I had open in my previous session. This includes both saved queries and any unsaved queries, which are listed as SQLQuery1.sql
, SQLQuery2.sql
, etc.
I can't seem to find where these "unsaved" queries are being saved. I've checked Documents\SQL Server Management Studio\Backup Files\
(and every other directory in that vicinity). I've also checked the C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\
directory and subdirectories (as best I could). Finally, I did a complete search on my computer for the filename SQLQuery1.sql
and it turned up nothing (not that I trust the Windows search function in file explorer).
In case it changes things at all, I also have installed the Redgate SQL Prompt add-on for SSMS.
Any other suggestions?
Thanks!
Upvotes: 6
Views: 13432
Reputation: 340
I got my saved query in the following way.
Upvotes: 0
Reputation: 3571
It's very simple :)
Create new query, then right click on the tab and then choose Open containing folder
option.
For example, I got C:\Users\PKuderov\AppData\Local\Temp
folder and my SQLQuery4.sql is named ~vs3C67.sql
.
So @BenjaminSmith is right but these files have unique temporary names. Until you explicitly save them where you want. It seems they survive ssms reload and you can further filter them by .sql
extension and Date Modified
.
Upvotes: 6
Reputation: 158
How about the TEMP folder? Try searching for %TEMP% from your start menu and searching in there.
Upvotes: 0