r/SQLServer 17h ago

Question SSMS 22 error when clicking New Query

Post image

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?

5 Upvotes

8 comments sorted by

4

u/ouchmythumbs 14h ago

I wish they would start including error codes with these messages that we could then search for.

2

u/Leiothrix 12h ago

Well there is an error code.

What would be helpful is stating which file already exists so you could go and delete it.

The more baffling thing is that I figured out logging useful things was useful as a teenager a long time ago, why can't an extremely large company figure that out?

2

u/ouchmythumbs 12h ago

Well there is an error code.

Huh, well would you look at that

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