| title | Quickstart: Chat with @mssql (Ask Mode) | ||
|---|---|---|---|
| titleSuffix | MSSQL Extension for Visual Studio Code | ||
| description | Learn how to use the @mssql chat participant in GitHub Copilot ask mode to write schema-aware SQL queries, explain relationships, and generate migrations in Visual Studio Code. | ||
| author | rwestMSFT | ||
| ms.author | randolphwest | ||
| ms.reviewer | roblescarlos | ||
| ms.date | 06/01/2026 | ||
| ms.service | sql | ||
| ms.subservice | vs-code-sql-extensions | ||
| ms.topic | quickstart | ||
| ms.collection |
|
||
| ai-usage | ai-assisted |
The @mssql chat participant brings schema-aware SQL assistance into your GitHub Copilot Chat conversations. In ask mode, you have a natural-language conversation with @mssql about your connected database: explore tables and relationships, write Transact-SQL (T-SQL) queries, generate migrations, and get explanations of existing objects. Ask mode is read-only. It answers questions and proposes code, but never modifies files.
Tip
Use ask mode when you need an answer or a one-shot query. Use agent mode for multi-step workflows that involve tool execution. Use edit mode when you need targeted changes to specific files.
@mssqlin ask mode is schema-aware when you have an active database connection.- The chat participant reads schema metadata (tables, columns, relationships) and includes it in each request.
- Ask mode is conversational and stateless. Each message is a new question.
- Your custom instructions apply to every ask mode response.
[!INCLUDE get-started]
Use @mssql in GitHub Copilot Chat to bring intelligent, context-aware assistance into your SQL development workflow. Whether you're writing queries, exploring schema, or generating migration scripts, GitHub Copilot tailors responses to your connected database.
Here are common use cases and examples.
Ask questions about tables, columns, schemas, and object metadata.
Show all objects in the `SalesLT` schema of my current database, grouped by type.
List the columns, data types, and nullability of the `SalesLT.Customer` table.
How many tables, views, and procedures are defined in my current database?
Get help writing common SQL queries for filtering, aggregation, and joins.
Write a T-SQL query to list all customers from `SalesLT.Customer` who placed
an order in the last 30 days based on the latest order date.
Generate a query that calculates the average order total per customer
from the `SalesLT.SalesOrderHeader` table, sorted descending.
Update the previous query to include the full name of each customer
from the `SalesLT.Customer` table.
Ask for simplified explanations of schema relationships, query logic, or T-SQL features.
Describe the foreign key relationship between `SalesLT.SalesOrderHeader`
and `SalesLT.Customer` tables in my current database.
I'm a developer new to T-SQL. Explain how `SalesLT.SalesOrderHeader` is
related to `SalesLT.Customer`, and what keys are involved.
Explain how vector data types work in SQL Server and when to use them
for artificial intelligence (AI) scenarios.
Request help generating SQL or object-relational mapping (ORM) migration scripts.
Create a T-SQL script to add a foreign key constraint on
`SalesLT.SalesOrderDetail.ProductID` referencing `SalesLT.Product.ProductID`.
Generate a Sequelize migration to add a foreign key from
`SalesLT.SalesOrderDetail.ProductID` to `SalesLT.Product.ProductID`,
assuming both columns exist.
For object-relational mapping (ORM) examples across Entity Framework, Prisma, SQLAlchemy, and other frameworks, see Object-relational mapping integrations with GitHub Copilot.
| Scenario | Best mode |
|---|---|
| "What does this stored procedure do?" | Ask mode |
| "Write a query to find orders over $500" | Ask mode |
| "Connect to my LocalDev profile and list databases" | Agent mode |
| "Add audit columns to every table in the Sales schema" | Agent mode |
| "Design a full data model from my PRD" | Plan mode |
[!INCLUDE copilot-feedback]
- How GitHub Copilot works with the MSSQL extension
- Quickstart: Use GitHub Copilot agent mode
- Quickstart: Use GitHub Copilot slash commands
- Quickstart: Use plan mode for spec-driven database design
- Quickstart: Use inline GitHub Copilot completions in SQL files
- Quickstart: Use custom instructions to align GitHub Copilot with your T-SQL conventions
- Object-relational mapping integrations with GitHub Copilot
- Limitations and known issues