Edit

Share via


What is Copilot in SQL Server Management Studio (Preview)?

Use Copilot in SQL Server Management Studio (SSMS) to ask questions about your database and environment, and get help writing Transact-SQL (T-SQL) with AI.

Copilot in SSMS doesn't retain any of your information (prompts, responses, system metadata, and so on) and doesn't use any of your data to train or retrain models. For more information, see Data, privacy, and security for Microsoft Azure OpenAI Service.

Copilot in SSMS can answer questions for databases in SQL Server, Azure SQL Database, Azure SQL Managed Instance, and SQL Database in Fabric. Copilot executes queries based on the permissions for your login. For example, if you don't have permission to select from the table Sales.Orders and you ask Copilot to write and execute a select query such as SELECT TOP 100 * FROM Sales.Orders, the query execution can't occur.

How Copilot works in SSMS

Copilot in SSMS uses Azure OpenAI resources, requiring an endpoint and deployment in your Azure subscription. The model selected when configuring your deployment is the model to which Copilot in SSMS sends your prompts, and that model then generates the response. Copilot in SSMS might send additional information about the version of SQL to which you're connected, or information about your database, to help improve the response.

Features of Copilot in SSMS

The primary feature of Copilot in SSMS is the chat window, in which you use natural language to ask questions about your database or get help writing T-SQL. Copilot in SSMS also includes code assistance to help document, explain, fix, or refactor your T-SQL queries. To enable Copilot in SSMS, see Install Copilot in SQL Server Management Studio.

Best practices for using Copilot in SSMS

To maximize your productivity with Copilot in SSMS, open a query editor that's connected to your database, then open the chat window. By default, the chat window understands the database you're connected to based on the active query editor. When writing prompts, be specific in your request as vague questions lead to vague responses. For more best practices, see Best practices for Copilot in SQL Server Management Studio.

Example prompts

The following example prompts are clear, specific, and tailored to the properties of your schema and database, making it easier for Copilot in SSMS to generate accurate replies.

  - What are the top-selling products by quantity?
  - How do I change the compatibility mode for this database?
  - Is there blocking in my database right now?

More examples can be found in Best practices for Copilot in SQL Server Management Studio.

Responsible AI use of Copilot in SSMS

Copilot in SSMS adheres to Responsible AI practices for Azure OpenAI models. Microsoft is committed to ensuring that our AI systems are guided by our AI principles. Learn more about the AI principles for Copilot in SSMS in the Transparency Note for Copilot in SQL Server Management Studio. These principles include empowering our customers to use these systems effectively and in line with their intended uses. Our approach to responsible AI is continually evolving to proactively address emerging issues.

Limitations

Here are the current limitations of Copilot in SSMS:

  • Copilot can't change existing T-SQL queries in the query editor. For example, if you ask Copilot chat window to edit a specific part of an existing query, it doesn't work. However, Copilot understands previous inputs in the chat window, allowing users to iterate queries previously generated by Copilot before they're inserted.
  • Copilot might produce inaccurate results when the intent is to evaluate data.
  • Copilot responses can include inaccurate or low-quality content, so review outputs before using them in your work.
  • People who can meaningfully evaluate the content's accuracy and appropriateness should review the outputs.
  • If your Azure OpenAI endpoint uses Microsoft Entra Authentication, Copilot in SSMS isn't accessible if you open SSMS as a different user than the user logged into the machine. For example, if you log in to the machine as contoso\jwilson and you open SSMS as contoso\admin, Copilot in SSMS isn't accessible.
  • When using Managed Identity to authenticate to an Azure Virtual Machine running SSMS, Copilot in SSMS isn't accessible if the Azure OpenAI endpoint is using Microsoft Entra Authentication, and the user opens SSMS as a different user.