I’m looking for a way to have sql server treat a different file extension as an .sql file… My company policy is that we name stored procedures as .PRC instead of .SQL. This makes it a hassle to open a file and edit/execute it. While I can associate SQL Server Management Studio to open the file, it doesn’t treat it as a script so all the options to execute the script as well as color coding of the script are disabled.
Currently I have to copy out the script and paste it into a new query, then when I’m done editing paste it back and save it. This is all related to our source control and is a major pain. Any way to fool sql server and have it treat these as .sql files so I can execute them directly?
You can add the extension from the options dialog (tools->options). Then under Text Editor-File Extension and then choose the editing experience you want
Once applied you can use it as you did .SQL. In the following image note the highlighting and the result set on the file SQLQuery.rpc