Browse, filter, search and edit database tables in VS Code. Works with SQL Server, PostgreSQL, MySQL/MariaDB and SQLite.
Getting started
- Open the SqlTools view in the activity bar.
- Click Add Connection, or Add Demo SQLite Database to try it on sample data (
StoreDemo, about 200k rows).
- Click a table to open it.
Passwords go in the OS keychain (VS Code SecretStorage). Connection strings are saved without them.
SQLite files: right-click a .db, .sqlite, .sqlite3 or .db3 file and choose Open With… → SqlTools Grid. A table picker in the toolbar switches between tables. To make it the default for these files, use Configure default editor in the same menu. A file opened this way isn't added to your saved connections.
The grid
|
|
| Fast on big tables |
Rows are fetched from the server in blocks as you scroll. Only the visible rows are in the DOM. |
| Filter row |
abc contains · =x · !=x · >5 · <=2024-01-01 · 1..10 · in:1,2,3 · a%b (LIKE) · null · !null. Filtering runs on the server and is parameterized. |
| Search |
One box searches all text, date and number columns. |
| Sort |
Click a header to sort. Shift+click adds more sort columns. |
| Editing |
Cells are edited in place: click the selected cell again, press Enter or F2, or just start typing. Long text and JSON/XML get an expanding text box (Shift+Enter for a new line, Ctrl+Enter for a larger editor). Booleans are checkboxes, foreign keys offer a dropdown of parent rows, binary is edited as hex. Ctrl+0 sets NULL. |
| Double-click |
Opens the row details panel with that column's field focused. |
| Pending changes |
Changed cells turn yellow, new rows green, deleted rows red. Review & Commit (Ctrl+S) shows the SQL first and runs it in one transaction. If any statement fails, nothing is saved. |
| Foreign keys |
FK cells show 42 · Acme Corp. Ctrl+click opens the parent row. Children shows the rows in other tables that reference the selected row. |
| Row details |
A side form for wide tables. |
| Copy As |
Copy selected rows as TSV, CSV, JSON, Markdown, INSERT, UPDATE or a C# object initializer. |
| Paste rows |
Paste rows copied from Excel (Ctrl+Shift+V). A header row is matched to column names. The rows become pending inserts. |
| Test data |
Generate creates realistic fake rows (names, emails, prices, dates, valid FK values) as pending inserts. |
| Saved views |
Save filters, search, sort, widths and hidden columns per table to .vscode/sqltools-views.json, which you can commit and share. |
| Column stats |
Right-click a header: null %, distinct count, min/max and top values. |
Tables without a primary key, and views, open read-only.
- ER diagram: for a whole database or for one table and its neighbors. Drag tables, pan and zoom, export to SVG or PNG.
- Compare With…: compares a table across two connections (for example dev and staging). Shows schema differences and data differences by primary key, and generates a sync script.
- Code generation: C# POCO, EF Core entity (with navigation properties) or TypeScript interface.
- Run SQL: select SQL in any editor and press
Ctrl+Alt+E. String quoting in C#/JS/TS/Python is removed automatically. A ▶ Run SQL CodeLens appears above SQL string literals. @name, :name and $1 parameters prompt for values.
Notes
- SQL Server uses the pure-JavaScript
tedious driver. It needs TCP enabled and a SQL login (or Azure AD with a password). Windows integrated authentication for the current user is not supported yet.
- SQLite uses the
node:sqlite module built into VS Code's runtime, so no native modules are needed.
Settings
| Setting |
Default |
|
sqltools.pageSize |
200 |
Rows fetched per block while scrolling |
sqltools.lookupDisplay |
true |
Show parent display text next to FK values |
sqltools.codeLens |
true |
Show ▶ Run SQL above SQL string literals |
| |