views:

300

answers:

4

I seem to have lost the association from .sql files to the default VS T-SQL editor. I'm using Visual Studio 2008. When i open a .sql file it opens using a text editor with no syntax highlighting. How do I reassociate all .sql files with the default T-SQL editor while inside Visual Studio?

A: 

in file explorer, right click on the .sql file, chose "open with" then "choose program...", select VS and check "always use..."

KM
i chose "open with" and don't have the choice of VS. I have choices of XML, Source Code, HTML, Binary, Resource editors. I've tried them all (currently using Source Code editor). I added VS (devenv.exe) as a program and used that but it opened a new instance of VS with the Source Code editor (no syntax highlighting)
@Scott, the open with list will list window's bets guesses. Isn't there a "choose program..." option at the bottom? this will open a dialogue box where you can pick any program you want.
KM
@KM, thanks for working with me on this, yes i did get a choose program. That is the option I chose to select VS as in your suggestion. But which exe do I choose then for the built-in T-SQL editor with visual studio. I tried selecting VS as you suggested but the exe i chose is devenv.exe and that opened another instance of VS but still used the source code editor with no highlighting.
@Scott, I don't have VS, so I can't tell you
KM
A: 

If you are not in a "SQL Server Project" you don't have the T-SQL Editor (Default Project Editor), just the default one. You can always use the default text editor which is not much different.

Marc Climent
A: 

Edit Registry, copy GUID from key HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\Languages\Language Services\T-SQL\Default

Create new key .sql in HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\Languages\File Extensions and default value set to GUID from first step.

Restart VS

A: 

Thanks Pavel, works like a charm. In my case I copied the guid from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\Language Services\T-SQL90\Default and created a new .sql key in HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\File Extensions.

cosmos