How to Make VS Code Look and Feel Like SSMS (SQL Server Management Studio)
Two free tools to bring your favorite SSMS features into VS Code:
- A keybindings.json file for SSMS-style column/box selection, and to free up
Ctrl+1toCtrl+4for query shortcuts- A VS Code extension that replicates SSMS Query Shortcuts (
Ctrl+3=SELECT TOP 1000 * FROM ...)Both files work together. Download links are at the bottom of each section.
Why Switch from SSMS to VS Code?
VS Code is fast, lightweight, and extensible. With the mssql extension, it connects to SQL Server and lets you write and run queries just like SSMS.
But if you have been using SSMS for years, two things will feel off right away:
- Column selection does not work the same way. In SSMS,
Alt+Shift+Arrowgives you a clean rectangular (box) selection. In VS Code, the same shortcut creates multi-cursors, which behaves very differently. - Query Shortcuts are missing. In SSMS, you can highlight a table name and press
Ctrl+3to instantly runSELECT TOP 1000 * FROM YourTable. VS Code has no built-in equivalent.
This post solves both problems.
Part 1: SSMS-Style Column Selection and Keybinding Fixes
What this fixes
In SSMS, Alt+Shift+Arrow selects a rectangular block of text (box selection). The selection stays within a column and does not wrap to the next line. This is extremely useful when working with aligned SQL code.
VS Code uses the same shortcut for multi-cursor mode, which adds cursors on multiple lines instead. If you are coming from SSMS, this feels wrong.
What you get
The custom keybindings file remaps VS Code to behave like SSMS:
| Shortcut | Behavior |
|---|---|
Alt+Shift+Arrow | Column (box) selection, exactly like SSMS |
Alt+Shift+PageUp/PageDown | Column select by page |
Shift+Arrow | Normal text selection (no multi-cursor) |
Ctrl+Shift+Arrow | Word-level selection |
Shift+Home/End | Select to start/end of line |
Ctrl+R | Toggle the results/terminal panel (same as SSMS Ctrl+R) |
Toggle the results panel with Ctrl+R
In SSMS, pressing Ctrl+R hides or shows the results pane. This is very handy when you want more screen space for your query, or when you want to quickly check results and hide them again.
The keybindings file maps Ctrl+R to VS Code’s workbench.action.togglePanel command, which toggles the bottom panel (terminal, results, problems). Same shortcut, same behavior.
Important: freeing up Ctrl+1 to Ctrl+4
By default, VS Code uses Ctrl+1, Ctrl+2, Ctrl+3, and Ctrl+4 to switch between editor groups (split panes). This means that without this keybindings file, the query shortcuts from Part 2 would conflict with these built-in VS Code shortcuts.
The keybindings file takes care of this: it disables the default Ctrl+1 to Ctrl+4 editor group bindings, so the query shortcut extension can use them without any conflict.
Both parts work together. If you install the query shortcuts extension (Part 2) without this keybindings file, pressing
Ctrl+1toCtrl+4will switch editor groups instead of running your SQL queries. Make sure to install both.
Installation
- Open VS Code
- Press
Ctrl+Shift+Pand type “Preferences: Open Keyboard Shortcuts (JSON)” - Paste the contents of the downloaded file into the JSON array
- Add these two settings to your
settings.json(Ctrl+Shift+P> “Preferences: Open Settings (JSON)”):
"editor.columnSelection": false,
"editor.multiCursorModifier": "ctrlCmd"
editor.columnSelection: falseprevents VS Code from using column selection as the default for all selections.editor.multiCursorModifier: "ctrlCmd"changes the multi-cursor trigger fromAlt+ClicktoCtrl+Click, which avoids conflicts with the column selection shortcuts.
Download
Part 2: SSMS Query Shortcuts (VS Code Extension)
What this fixes
In SSMS, you can go to Tools > Options > Environment > Keyboard > Query Shortcuts and assign SQL templates to keyboard shortcuts. For example, Ctrl+3 runs SELECT TOP 1000 * FROM with whatever table name you have selected.
This is one of the most popular SSMS productivity features (I wrote a blog post about it back in 2019). VS Code and the mssql extension do not offer this.
So I built a VS Code extension that brings it back.
I vibe coded this extension with Claude Code. I described the SSMS behavior I wanted to replicate, and Claude Code generated the full extension from scratch: the manifest (
package.json), the keybindings, the settings schema, and the inject/execute/undo logic (extension.js). The whole thing was built through a conversation, not by writing code manually. So, you are informed :)
Default shortcuts
| Shortcut | SQL Template |
|---|---|
Alt+F1 | EXEC sp_help '{0}' |
Ctrl+1 | EXEC sp_who |
Ctrl+2 | EXEC sp_lock |
Ctrl+3 | SELECT TOP 1000 * FROM {0} |
Ctrl+4 | SELECT COUNT(1) AS Nb FROM {0} |
Ctrl+5 to Ctrl+0 | Empty, ready for your own queries |
{0} is replaced by the text you have selected, or the word under your cursor.
Remember:
Ctrl+1toCtrl+4are used by VS Code by default to switch editor groups. The keybindings file from Part 1 disables those defaults so these query shortcuts work properly. The extension also scopes its shortcuts to.sqlfiles only, so they will not interfere with your normal VS Code shortcuts in other file types.
How to use it
- Open a
.sqlfile connected to a SQL Server database (via the mssql extension) - Select a table name, or just place your cursor on one
- Press the shortcut (for example
Ctrl+3) - The query runs and results appear in the results pane
- Your code is never modified, and no new tab opens
How it works under the hood
The extension uses a clever inject, execute, undo pattern to run your query without leaving any trace in your file:
- Capture the current cursor position and selection
- Get the target text by reading your selection, or if nothing is selected, by grabbing the word under your cursor (using VS Code’s
getWordRangeAtPositionAPI) - Build the SQL by replacing
{0}in the template with the target text - Append the generated query at the very end of the current document, separated by a
-- [SSMS Shortcut]comment line - Select only the appended SQL and call the mssql extension’s
runQuerycommand, which executes whatever text is currently selected - Wait briefly (500ms) for mssql to capture the query text
- Undo the insertion with a single
undocommand, which restores the document to its original state - Restore the cursor to its original position
The result: the query runs, the results appear, and your file looks exactly as it did before. No leftover text, no new tabs, no modifications to your code.
Customization
You can change any shortcut template in your VS Code settings.json:
"ssmsShortcuts.shortcuts": {
"altF1": "EXEC sp_help '{0}'",
"ctrl1": "EXEC sp_who",
"ctrl2": "EXEC sp_lock",
"ctrl3": "SELECT TOP 1000 * FROM {0}",
"ctrl4": "SELECT COUNT(1) AS Nb FROM {0}",
"ctrl5": "",
"ctrl6": "",
"ctrl7": "",
"ctrl8": "",
"ctrl9": "",
"ctrl0": ""
}
Replace any empty string with your own SQL template. Use {0} wherever you want the selected text to be inserted.
Installation
- Download the extension zip below
- Unzip it
- Copy the
ssms-query-shortcutsfolder to:%USERPROFILE%\.vscode\extensions\ - Restart VS Code
The mssql extension must be installed and your
.sqlfile must be connected to a SQL Server database for the query shortcuts to work.
Download
Quick Setup Checklist
If you want the full SSMS experience in VS Code, here is everything in order:
- Install the mssql extension
- Download and apply the keybindings.json for column selection and to free up
Ctrl+1toCtrl+4 - Add
editor.columnSelection: falseandeditor.multiCursorModifier: "ctrlCmd"to your settings - Download and install the ssms-query-shortcuts extension
- Restart VS Code
- Open a
.sqlfile, connect to your database, and enjoy your SSMS shortcuts