Overwrite .SQL files with VS T-SQL Editor
I seem to have lost touch with the .sql files in the standard VS T-SQL editor. I am using Visual Studio 2008. When I open the .sql file it opens with a text editor without syntax highlighting. How to rebuild all .sql files using the default T-SQL editor in Visual Studio?
Modify registry, copy GUID from key
HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\Languages\Language Services\T-SQL\Default
Create new .sql key in
HKLM\SOFTWARE\Microsoft\VWDExpress\9.0\Languages\File Extensions
and the default set to the GUID from the first step.
Restart VS
in the file explorer, right click on the .sql file, select "open with" then "select program ...", select "VS" and check "always use ..."
If you are not in the "SQL Server Project" you do not have a T-SQL editor (the default project editor), only the default. You can always use the default text editor, which isn't much different.
Thank you Pavel, 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
You need to install or reinstall some SQL files from ISO and it only took me 2 minutes. Namely:
Examine the ISO and go to the WCU folder then to the DAC folder and install the following files:
DACFramework_enu DACProjectSystemSetup_enu TSqlLanguageService_enu
This worked for me. I am using VS 2010 and SQL Server 2008 R2