| title | GitHub Copilot Chat | |
|---|---|---|
| titleSuffix | GitHub Copilot in SQL Server Management Studio | |
| description | Learn how to use the GitHub Copilot Chat experience in SQL Server Management Studio (SSMS). | |
| author | rwestMSFT | |
| ms.author | randolphwest | |
| ms.reviewer | erinstellato | |
| ms.date | 04/17/2026 | |
| ms.service | sql-server-management-studio | |
| ms.topic | how-to | |
| ms.collection |
|
|
| ms.update-cycle | 180-days |
The Chat window for GitHub Copilot in SQL Server Management Studio (SSMS) enables enhanced AI-assisted database administration and development in SSMS. It helps you be more productive and efficient when working with your SQL database.
Queries generated by GitHub Copilot in SSMS are executed under the context of the user's login and permissions. There are no separate permissions for GitHub Copilot. In Ask mode, Copilot uses a classification system to determine whether a generated query is read-only before executing it.
Important
Although this system blocks write operations, it's not a security boundary. Enforce access control at the database layer by using least-privilege principles: grant users only the SELECT and EXECUTE permissions they need on the specific objects they should access. The security boundary is SQL Server's permission enforcement, not Copilot's classification system.
In this article, you learn about using GitHub Copilot Chat in SSMS, a fully integrated AI-powered chat experience from GitHub Copilot that exists directly in SSMS. It enables you to get Transact-SQL (T-SQL) support, including syntax and context-specific help, without leaving the SSMS UI. Use the chat interface to submit your question as prompt and provide intent for better scoped answers.
GitHub Copilot Chat provides AI assistance to help you make informed decisions about your SQL database and write better T-SQL faster. With an integration in SSMS that includes connection context and schema understanding, GitHub Copilot Chat understands what you're working on and can help with tasks including:
-
T-SQL assistance:
- Get context-specific code suggestions and recommendations.
- Understand and document what a query does.
- Get assistance fixing syntax errors in your query.
- Refactor queries.
-
Database administration:
- Get help managing settings, security, and more.
- Configure and monitor database maintenance.
- Implement new SQL features.
-
Database development:
- Schema design.
- Data type selection.
- Indexing recommendations.
To use GitHub Copilot Chat in SSMS, you need SSMS 22 or a later version with the AI Assistance workload, and a GitHub account with Copilot access. Otherwise, you can use Use GitHub Copilot for free in SQL Server Management Studio.
Ask database and T-SQL questions in natural language and GitHub Copilot Chat answers them in the context of your database and its connection.
You can ask Copilot these questions in two places: the chat window, or directly inline in the code that you're looking to modify, using inline chat. For questions where you want to modify or add to the SQL file open in the editor, the inline chat view might work best. Use the chat window for answers to general T-SQL questions.
To improve Copilot chat results, learn how to use reference files, threads, and slash commands to get better answers with scoped context in Copilot Chat.
The chat window of Copilot Chat in SSMS enables you to ask your questions and see answers in the chat window. It's usually the preferred way to work with Copilot for database help and general T-SQL questions.
- Open a query editor window and connect to your database.
- In SSMS, select View > GitHub Copilot Chat.
- Use the example starter prompts in the chat window to start exploring Copilot Chat, or type in a prompt and select Enter or Send to submit your question.
- If Copilot Chat offers a T-SQL suggestion you want to use, select Apply to apply the code to the active query editor, Copy code block to copy the suggestion, or Add to new file to insert the code suggestion in a new file.
- If you ask for help with understanding your code, the Insert in new file option isn't available.
- If you select Apply, the code suggestion is applied to the active editor in the diff view pattern. You can review and refine what is being proposed and apply it using Tab, or discard it using Alt+Delete.
The inline chat view of Copilot Chat in SSMS enables you to ask your questions and see answers inline with the code directly in the editor window. With inline chat, you don't have to go back and forth to the chat window. You might find it easier to work with Copilot on questions that add to or update a currently open SQL file using inline chat.
- In SSMS, select Alt+/ to bring up the inline chat view of Copilot Chat in the editor.
- Type your T-SQL related question in the Ask Copilot text box, and then select Enter or Send to ask your question.
- Code suggestions from Copilot Chat appear in the diff view. You can review and refine what is being proposed and apply the change to your code using Tab, or discard it using Alt+Delete.
- You can promote your inline chat thread to the chat window by selecting View in chat window. Promoting the chat to the window preserves the record and context of your conversation, and you can continue in the chat window.
- Select Esc to close the inline chat view.
Note
Queries from GitHub Copilot in SSMS are executed under the context of the user's login and permissions, whether from the chat window or inline chat view. There are no separate permissions for GitHub Copilot in SSMS.
As you ask questions and send prompts in a chat session, Copilot uses the history of chat prompts and responses. The previous prompts and responses provide context to your current chat prompt. You can ask follow-up questions or clarify your previous question without having to repeat the context. For example, you can ask What is the compatibility mode for this database?, What are the differences between compatibility mode 140 and 170?, Do all users need to be out of the system when changing compatibility mode?, and more.
Use threads to start a new conversation for a new task. Select Create new thread or Ctrl+N in the chat window to start a new thread. New threads are useful when you want to move to a different topic and avoid the previous context and history. Use threads to keep conversations focused on the task at hand, and keep the context clear so the answers are based on relevant history.
You can toggle between multiple ongoing threads to provide the right historical context for your question. Use Ctrl+Page Down for next thread or Ctrl+Page Up for previous thread in the chat window. Ctrl+Shift+T expands the thread dropdown list.
To preserve the history of your inline chat, promote it to the chat window. Select View in chat window to maintain a record and context of the conversation, and continue in the chat window.
To start over with a new chat session and discard the current context, select Delete thread. Delete threads that are no longer relevant or that didn't give you the desired result.
You can preview any Markdown content generated by Copilot Chat directly in the Markdown editor. When Copilot Chat generates Markdown content, select the Preview button in the upper-right corner of the chat window to see a rendered preview. You can edit and save the Markdown content as needed. This feature is helpful when you want to quickly visualize and work on Markdown files without manually copying and pasting.
Copilot Chat can generate Mermaid diagrams, including entity relationships, flowcharts, Gantt, and more. You can then visualize complex relationships and workflows directly in the editor.
For example, you might use one or more of the following prompts:
Visualize the relationships between tables in this database as a Mermaid diagramVisualize the relationships between tables in the Orders schema of this database as a Mermaid diagramCreate a Mermaid flowchart for the steps to change the compatibility mode
Copilot uses your active query editor and any references you add to gather context, and then returns the Mermaid syntax in the chat window. Select Preview to open a new Markdown file and view the diagram. You can save or share the Markdown or rendered chart for future use.
Tip
You can use the Markdown preview controls to switch between preview modes and zoom in on complex Mermaid diagrams.
You can customize Copilot for your workflow and requirements in SSMS.
-
Manage context with references: Use the + button to attach more context, such as
.sqlfiles or.sqlplanfiles. For more information, see Add context for GitHub Copilot in SQL Server Management Studio. -
Access different models: Use the model picker in the prompt window to select AI models, or bring your own model to Copilot. Explore different models for different scenarios, whether it's answering quick questions, writing documentation, or generating code edits. For more information, see AI models for GitHub Copilot in SQL Server Management Studio.