0

I want to link Excel files to a solution in SSMS to have the handy for reference. Adding them works just fine. They show up under Miscellaneous. SSMS recognizes that they are Excel files by putting the logo next to them. However, when I select one, I get an error.

Microsoft SQL Server Management Studio

Unable to open file Summary.xlsx. File may not have an associated editor.

Oddly, once selected, I can double-click the file and it opens in Excel as expected.

I tried setting the extension in Tools > Options... > Text Editor > File Extension but, obviously, that is for text editors. None of the available editors in the list is an Excel editor. So, I set it to the Automatic Editor Selector (XML) option. The error still occurs.

I have also reviewed Management Studio won't recognize other file extensions and do not think this is the same question. Please correct me if I'm wrong.

The idea is just to have the files handy. I'm ok with double-clicking them to open them in Excel, but is there some way to get rid of that error that happens when I select the file? Is what I'm doing an uncommon practice?

Version Info

Component Name Versions
SQL Server Management Studio 19.0.20209.0+f9a9d8f6
SQL Server Management Objects (SMO) 16.200.48036.0+7d3b143d945e1aa638acdb02c0364e263d5ec973
Microsoft T-SQL Parser 16.0.22524.0+62eedb15cd3cde34e51c8fbbdf9b06e575ec912e
Microsoft Analysis Services Client Tools 16.0.19993.0
Microsoft Data Access Components (MDAC) 10.0.19041.3208
Microsoft MSXML 3.0 6.0
Microsoft .NET Framework 4.0.30319.42000
Operating System 10.0.19045

2 Answers 2

2

What's happening is that SSMS is trying to preview the files. I noticed that if I selected a normal SQL script it simply selected it. When selecting a non-SQL file, it would try to open the file in a preview tab.

I went into Tools > Options > Environment > Tabs and Windows and found the Preview Tab selection. I unselected Preview Selected Files in Solution Explorer. Now, when simply selecting the file, it does not try to preview it in a code window. The error is gone.

Problem solved.

View of the Options Window Showing the Preview Options

1
  • Interesting, good to know.
    – J.D.
    Jul 14, 2023 at 15:36
1

Is what I'm doing an uncommon practice?

IMO, it's pretty rare. I've never heard of anyone using Solutions in SSMS, and I'm sure it's a feature Microsoft hasn't spent much TLC on in a long time. Let alone providing an editor for Excel files. I doubt that's ever been available.

So, I set it to the Automatic Editor Selector (XML) option. The error still occurs.

Makes sense, XML is completely different from Excel files.

I want to link Excel files to a solution in SSMS to have the handy for reference.

What benefit do you stand to gain by doing this, knowing that they can't be opened / edited in SSMS, as opposed to just keeping the folder they're physically located in open?

4
  • The benefit is that project scripts and requirements docs are in one handy reference in SSMS, I can have multiple projects (so multiple folders) open in a single solution with all my files nicely clustered. It's just handier. I can open the file with a double-click, I just can't select it without getting an error. Without solutions, I would be jumping back and forth between multiple File Explorer windows and SSMS. I'm surprised that using solutions is rare. They are pretty darn convenient.
    – StoneGiant
    Jul 14, 2023 at 14:51
  • @StoneGiant Gotcha sounds like shortcuts would natively solve your problem equally. You would only need one folder open then. SSMS isn't really built to be a file management tool. And yes I agree solutions can be a useful paradigm, I think in the context of databases and SSMS specifically, most people aren't working on a single project with a bunch of related SQL scripts and files usually, unlike when programming applications in Visual Studio. Usually multiple tabs in SSMS are series of ad-hoc or unrelated things that don't need to be saved as files in a solution. The changes of scripts are...
    – J.D.
    Jul 14, 2023 at 14:59
  • ...already immediately saved to the database itself after they're executed anyway. It's a different workflow / thought process I suppose.
    – J.D.
    Jul 14, 2023 at 14:59
  • 1
    Honestly, what I'm doing with SQL Server isn't meant for SQL Server, but I don't wanna talk about that right now. LOL. Hoping to move away from this approach within a year. I used to work ad-hoc, but with several projects interrelating in more than one way, solutions became critical. Anyway, I figured out what was happening and will answer my own question shortly. Thanks for the help. I appreciate it very much.
    – StoneGiant
    Jul 14, 2023 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.