Associate file extensions to a code editor
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
Associating file extensions to a specific code editor allows you to open a file with the appropriate SQL Server Management Studio code editor when you double-click a file in Windows Explorer. The extensions commonly used by Management Studio, such as .sql and .mdx, are associated during installation. New file extensions must also be associated to Management Studio in the file system. You can use this feature to open files created with other editors, or to open files you have renamed, such as backups of .sql files that were renamed .bak.
There are two steps in the process. First associate the extension with Management Studio, and then associate the extension with a specific code editor.
To associate a new file extension with SQL Server Management Studio
Open Windows Settings: Select the Start menu and select Settings.
Navigate to Default Apps: In the Settings window, select Apps, then select Default apps.
Choose Default Apps by File Type: Scroll down and Select Choose default apps by file type.
Find Your File Extension: Locate the file extension you want to associate (for example, .sql).
Set SSMS as Default: Select the current default app and select SQL Server Management Studio from the list.
Configure within SSMS: Open SSMS, go to Tools > Options, and under Text Editor, specify the editor for the new extension if necessary.
To associate a new file extension with a code editor in SQL Server Management Studio
In SQL Server Management Studio, from the Tools menu, select Options.
In the Options dialog box, select Text Editor, and then select File Extension.
In the Extension box, type your new file extension.
In the Editor box, select the code editor that you wish to use to open this file type, select Add, and then select OK.