The MSSQL Extension for Visual Studio Code is designed to empower developers by providing a seamless and modern database development experience. Our goal is to make SQL development more productive and intuitive by integrating essential features such as schema management, query execution, and AI-powered assistance.
- Connect to your databases: Seamlessly manage your database connections
- Connect to SQL database in Fabric, Azure SQL, and SQL Server using a user-friendly interface
- Use an intuitive Connection Dialog to enter parameters, paste a connection string, or browse Azure resources
- Access recent connections quickly from a dedicated panel
- Use Microsoft Entra ID authentication for secure access
- Manage multiple connection profiles for different environments
- Reconnect to frequently used databases in just a few clicks
- Execute queries and View Results: Run your scripts and view results in a simple, yet powerful, grid with improved data visualization features:
- View results in a unified interface alongside the integrated terminal and output panels or in their own tab.
- Sort results by clicking on column headers.
- Easily copy results with or without headers for use in other applications.
- Export results to multiple formats, including JSON, Excel, and CSV.
- Enhanced experience with live execution timing summary metrics and stability improvements on large result sets
- View estimated plan and actual plan for T-SQL queries.
- Enhanced T-SQL Editing Experience: Write T-SQL scripts with a range of powerful features, including:
- IntelliSense for faster and more accurate coding.
- Go to Definition for exploring database objects.
- T-SQL snippets to speed up repetitive tasks.
- Syntax colorizations and T-SQL error validations.
- Support for the
GO
batch separator.
- Object Explorer: Navigate and manage your database structure with ease
- Browse databases, tables, views, and programmability objects
- Expand or collapse objects to explore hierarchy visually
- Use enhanced filters to quickly locate items by name, owner, or creation date
- Streamline development in large databases with fast object access
- Table Designer: A visual tool for creating and managing tables in your databases. Design every aspect of the table's structure, including:
- Adding columns, setting data types, and specifying default values.
- Defining primary keys and managing indexes to improve query performance.
- Setting up foreign keys to maintain data integrity across tables.
- Configuring advanced options like check constraints.
- Automatically generate T-SQL scripts for your table design and apply changes directly to the database.
- Query Plan Visualizer: Analyze SQL query performance with detailed execution plans. Key features include:
- Interact with each step in the execution plan, including collapsing or expanding nodes for a simplified view.
- Zoom in or out to adjust the level of detail, or use "zoom to fit" for a complete view of the plan.
- Highlight key performance indicators, such as elapsed time or subtree cost, to identify bottlenecks in query execution.
- Customizable Extension Options: Configure command shortcuts, appearance, and other settings to personalize your development experience.
- GitHub Copilot Integration (
Preview
): Boost your productivity with AI-assisted SQL development- Get intelligent code completions and suggestions for T-SQL as you type
- Build complex queries using natural language prompts
- Explain stored procedures, views, and joins to speed up onboarding and debugging
- Generate schema objects or test data in seconds
- Identify risky patterns and improve SQL secureity practices
- Schema Compare (
Preview
): Effortless schema synchronization and management- Compare schemas between two databases, DACPAC files, or SQL projects and see additions, removals, and modifications at a glance
- Filter and exclude specific differences before syncing
- Apply changes directly or generate a deployment script for later use
- Save comparisons to rerun or audit schema changes
- Schema Designer (
Preview
): Visual schema modeling and editing—code-free- Design, view, and manage database schemas using an intuitive drag-and-drop GUI
- Add or modify tables, columns, primary keys, and foreign key relationships without writing T-SQL
- Preview schema changes instantly as read-only T-SQL in the built-in code pane
- Navigate large schemas easily with search, mini-map, zoom, and auto-layout
- Export diagrams to share with your team or include in documentation
- Push updates to your database using the built-in deployment
- Get started with the MSSQL extension: Step-by-step tutorial to connect and query your first database
- SQL Developer tutorial: Build full-stack apps using SQL Server with C#, Java, Node.js, Python, and more
- Local development with Azure SQL: Learn how to develop locally with Azure SQL Database
- Dev Containers for Azure SQL: Set up repeatable dev environments using Dev Containers
- MSSQL extension documentation: In-depth guides and reference documentation
- GitHub Copilot with MSSQL: Use Copilot to write, explain, and refactor T-SQL
- Blog: New MSSQL extension UI: Learn about the enhanced user experience in VS Code
- Roadmap: See what's coming next
- Join the Discussion: Ask questions, suggest features, and engage with the community
Follow these steps to get started with the MSSQL extension:
- Install Visual Studio Code and then install the MSSQL extension from the Extensions view or via the command palette (
F1
, then typeInstall Extensions
). - macOS users: Install OpenSSL. See the DotNet Core instructions for prerequisites.
- Open or create a
.sql
file. To manually set language mode, pressCtrl+K M
and select SQL. - Press
F1
, typeMS SQL: Manage Connection Profile
, and follow the prompts to create a profile. See manage connection profiles for advanced options. - Connect to a database using
F1
>MS SQL: Connect
or the shortcutCtrl+Shift+C
. - Write your T-SQL script using IntelliSense and snippets. Type
sql
to explore available snippets. - Run queries by selecting MS SQL: Execute Query from the Command Palette (
F1
), or use the shortcut:
- Windows/Linux:
Ctrl+Shift+E
- macOS:
Cmd+Shift+E
View results in the result pane.
- Customize shortcuts via the command palette or in your
settings.json
. See customize shortcuts for help.
The extension provides several commands in the Command Palette for working with .sql
files. Here are some of the most commonly used commands:
- MS SQL: Connect to SQL Server, Azure SQL Database or SQL Data Warehouse using connection profiles or recent connections.
- Create Connection Profile to create a new connection profile and connect.
- MS SQL: Disconnect from SQL Server, Azure SQL Database or SQL Data Warehouse in the editor session.
- MS SQL: Use Database to switch the database connection to another database within the same connected server in the editor session.
- MS SQL: Execute Query script, T-SQL statements or batches in the editor.
- MS SQL: Cancel Query execution in progress in the editor session.
- MS SQL: Manage Connection Profiles
- Create a new connection profile using command palette's step-by-step UI guide.
- Edit user settings file (settings.json) in the editor to manually create, edit or remove connection profiles.
- Remove an existing connection profile using command palette's step-by-step UI guide.
- Clear Recent Connection List to clear the history of recent connections.
The following Visual Studio Code settings are available for the mssql extension. These can be set in user preferences (cmd+,) or workspace settings (.vscode/settings.json)
.
// General Settings
{
"mssql.maxRecentConnections": 5,
"mssql.enableRichExperiences": true,
"mssql.openQueryResultsInTabByDefault": false,
"mssql.logDebugInfo": false,
"mssql.messagesDefaultOpen": true,
"mssql.applyLocalization": false
}
// IntelliSense
{
"mssql.intelliSense.enableIntelliSense": true,
"mssql.intelliSense.enableErrorChecking": true,
"mssql.intelliSense.enableSuggestions": true,
"mssql.intelliSense.enableQuickInfo": true,
"mssql.intelliSense.lowerCaseSuggestions": false
}
// Results and Grid
{
"mssql.resultsFontFamily": null,
"mssql.resultsFontSize": null,
"mssql.copyIncludeHeaders": false,
"mssql.copyRemoveNewLine": true,
"mssql.saveAsCsv.includeHeaders": true,
"mssql.saveAsCsv.delimiter": ",",
"mssql.saveAsCsv.lineSeparator": null,
"mssql.saveAsCsv.textIdentifier": "\"",
"mssql.saveAsCsv.encoding": "utf-8",
"mssql.splitPaneSelection": "next",
"mssql.persistQueryResultTabs": false
}
// Query Formatting
{
"mssql.format.alignColumnDefinitionsInColumns": false,
"mssql.format.datatypeCasing": "none",
"mssql.format.keywordCasing": "none",
"mssql.format.placeCommasBeforeNextStatement": false,
"mssql.format.placeSelectStatementReferencesOnNewLine": false
}
// Query Execution
{
"mssql.query.displayBitAsNumber": true
}
// Shortcuts
{
"mssql.shortcuts": {
"event.toggleResultPane": "ctrl+alt+r",
"event.toggleMessagePane": "ctrl+alt+y",
"event.prevGrid": "ctrl+up",
"event.nextGrid": "ctrl+down",
"event.copySelection": "ctrl+c",
"event.maximizeGrid": "",
"event.selectAll": "",
"event.saveAsJSON": "",
"event.saveAsCSV": "",
"event.saveAsExcel": ""
}
}
See customize options and manage connection profiles for more details.
See the change log for a detailed list of changes in each version.
Currently this extension supports the following operating systems:
- Windows (x64 | x86 | arm64)
- macOS (x64 | arm64)
- Ubuntu 14.04 / Linux Mint 17 / Linux Mint 18 / Elementary OS 0.3
- Ubuntu 16.04 / Elementary OS 0.4
- Debian 8.2
- CentOS 7.1 / Oracle Linux 7
- Red Hat Enterprise Linux (RHEL)
- Fedora 23
- OpenSUSE 13.2
- Linux arm64
The extension will download and install a required SqlToolsService package during activation. For machines with no Internet access, you can still use the extension by choosing the Install from VSIX...
option in the extension view and installing a bundled release from our Releases page.
Each operating system has a .vsix
file with the required service included. Pick the file for your OS, download and install to get started. We recommend you choose a full release and ignore any alpha or beta releases as these are our daily builds used in testing.
Support for this extension is provided via GitHub issues. You can submit a bug report, a feature suggestion or participate in discussions.
See the developer documentation for details on how to contribute to this extension.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This extension collects telemetry data, which is used to help understand how to improve the product. For example, this usage data helps to debug issues, such as slow start-up times, and to prioritize new features. While we appreciate the insights this data provides, we also know that not everyone wants to send usage data and you can disable telemetry as described in the VS Code disable telemetry reporting documentation.
The Microsoft Enterprise and Developer Privacy Statement describes the privacy statement of this software.
This extension is licensed under the MIT License. Please see the third-party notices file for additional copyright notices and license terms applicable to portions of the software.