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

  1. Open Windows Settings: Select the Start menu and select Settings.

  2. Navigate to Default Apps: In the Settings window, select Apps, then select Default apps.

  3. Choose Default Apps by File Type: Scroll down and Select Choose default apps by file type.

  4. Find Your File Extension: Locate the file extension you want to associate (for example, .sql).

  5. Set SSMS as Default: Select the current default app and select SQL Server Management Studio from the list.

  6. 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

  1. In SQL Server Management Studio, from the Tools menu, select Options.

  2. In the Options dialog box, select Text Editor, and then select File Extension.

  3. In the Extension box, type your new file extension.

  4. In the Editor box, select the code editor that you wish to use to open this file type, select Add, and then select OK.