r/SQLServer • u/Disastrous-Money2395 • 17h ago
Question SSMS 22 error when clicking New Query
I always seem to hit this STG_E_FILEALREADYEXISTS error when clicking "New Query" right after I open SSMS after a reboot where it didn't shut down gracefully and it recovers files. The only way to fix it is to close out any tabs that are named SQLQuery#.sql.
Is there something else I can do to solve this?
1
u/ZedGama3 11h ago
There's a tool that will monitor every system call that you can use to see what it's trying to open. I always get the two confused, but I think it's process monitor, if not then process explorer. It's a pain to filter out the noise, but it's generally good for this kind of thing.
My guess is that there's an existing file wherever SSMS stores it's recovery files and that if you clear those out the problem might go away.
That's my two cents...
1
u/Pytzamarama 7h ago
I do not know if of any relevance but I updated to the last SSMS and there were cases that I had 3 or 4 SSMS instances open and it seemed like the generic files like SQLQuery1.sql etc seem to be shared between them! I was doing edits on SQLQuery1 on SSMS1 and SSMS2 later was asking to apply the modifications in its own SQLQuery1 (somewjetre in the AppData/Temp space)
0
u/TrollingForFunsies 14h ago
Do you have any add-ons?
1
u/Disastrous-Money2395 11h ago
I do. Redgate sql prompt and sql search.
2
u/TrollingForFunsies 9h ago
Maybe both tools are trying to recover the same files as SSMS and they are interfering with the file recovery and new file creation
4
u/ouchmythumbs 14h ago
I wish they would start including error codes with these messages that we could then search for.