|
| 1 | +--- |
| 2 | +title: Code Completions |
| 3 | +titleSuffix: GitHub Copilot in SQL Server Management Studio (Preview) |
| 4 | +description: Learn how to use code completions from GitHub Copilot in SQL Server Management Studio (SSMS). |
| 5 | +author: erinstellato-ms |
| 6 | +ms.author: erinstellato |
| 7 | +ms.reviewer: randolphwest |
| 8 | +ms.date: 01/21/2026 |
| 9 | +ms.service: sql-server-management-studio |
| 10 | +ms.topic: how-to |
| 11 | +ms.collection: |
| 12 | + - ce-skilling-ai-copilot |
| 13 | +ms.update-cycle: 180-days |
| 14 | +# CustomerIntent: As a database administrator or database developer, I want to understand how to use GitHub Copilot Completions in SQL Server Management Studio. |
| 15 | +--- |
| 16 | + |
| 17 | +# Use Code Completions in SQL Server Management Studio (Preview) |
| 18 | + |
| 19 | +Use GitHub Copilot in SQL Server Management Studio (SSMS) to enhance your Transact-SQL (T-SQL) development with AI assistance. GitHub Copilot helps you be more productive and efficient when writing T-SQL. |
| 20 | + |
| 21 | +In this article, you learn how to use GitHub Copilot Completions, which provide you with context-aware code completions, suggestions, and even entire code snippets. This feature helps reduce the time spent on repetitive tasks and minimizes errors. |
| 22 | + |
| 23 | +For related information about GitHub Copilot Chat, see [Use the GitHub Copilot Chat experience in SQL Server Management Studio (Preview)](chat.md). |
| 24 | + |
| 25 | +## How Code Completions work |
| 26 | + |
| 27 | +Code Completions for GitHub Copilot in SSMS use advanced machine learning models trained on a vast dataset of publicly available code from GitHub repositories. As you type code, the AI analyzes the context and provides relevant suggestions in real time. You can also receive suggestions by writing a comment in natural language that describes what you want the code to do. |
| 28 | + |
| 29 | +## Prerequisites |
| 30 | + |
| 31 | +Code Completions for GitHub Copilot in SSMS supports the T-SQL language. |
| 32 | + |
| 33 | +1. Install SSMS 22.2 or later with the [AI Assistance workload](installation-state.md#install-github-copilot-in-ssms-using-the-visual-studio-installer). |
| 34 | + |
| 35 | +1. Sign in to your GitHub account with Copilot access. |
| 36 | + |
| 37 | +[Use GitHub Copilot for free](free-plan.md). Sign up and use AI to code faster and more efficiently. |
| 38 | + |
| 39 | +## Use GitHub Copilot for code completions and suggestions |
| 40 | + |
| 41 | +As you type comments or T-SQL in the editor, GitHub Copilot provides context-aware code completions and suggestions. |
| 42 | + |
| 43 | +1. Open SSMS and connect to your database in query editor. |
| 44 | +1. In the editor, enter a comment to see inline code suggestions from GitHub Copilot: |
| 45 | + |
| 46 | + ```sql |
| 47 | + --list all tables in this database |
| 48 | + ``` |
| 49 | + |
| 50 | +1. Select enter to see the suggestion. |
| 51 | +1. To accept the suggestion, select <kbd>Tab</kbd>. To reject the suggestion, select <kbd>Esc</kbd> or continue typing. |
| 52 | + |
| 53 | +## Shortcuts and settings |
| 54 | + |
| 55 | +Several keyboard shortcuts are available for completions: |
| 56 | + |
| 57 | +- To manually trigger a completion, use <kbd>Alt</kbd>+<kbd>.</kbd> or <kbd>Alt</kbd>+<kbd>,</kbd>. |
| 58 | +- To cycle through available completions, use <kbd>Alt</kbd>+<kbd>.</kbd> to move to the next suggestion and <kbd>Alt</kbd>+<kbd>,</kbd> to move to the previous suggestion. |
| 59 | +- To partially accept a completion word by word, use <kbd>Ctrl</kbd>+<kbd>Right arrow</kbd>. |
| 60 | +- To partially accept a completion line by line, use <kbd>Ctrl</kbd>+<kbd>Down arrow</kbd>. |
| 61 | + |
| 62 | +You can customize your completion experience by changing selected settings. |
| 63 | + |
| 64 | +If completions appear too quickly and interrupt your typing, you can adjust the display timing in **Tools** > **Options** > **All Settings** > **Text Editor** > **Code Completions** > **Preferences**. Select **Show code completions only after a pause in typing** to stop displaying completions while you're typing. This setting adds a debounce delay, so completions don't flash and disappear while you're typing. |
| 65 | + |
| 66 | +By default, each keystroke automatically triggers completions. You can disable automatic completions in **Tools** > **Options** > **All Settings** > **Text Editor** > **Code Completions** > **General** when you set **Code Completion Invocation** to **Manual**. After you make this change, you can manually trigger completions using the <kbd>Alt</kbd>+<kbd>,</kbd> keyboard shortcut. |
| 67 | + |
| 68 | +## Completions model |
| 69 | + |
| 70 | +The GPT-4.1 Copilot model for code completions is currently the only available model for GitHub Copilot in SSMS. You can find the setting in **Tools** > **Options** > **All Settings** > **Text Editor** > **Code Completions** > **General** > **Copilot Completions Model**. |
| 71 | + |
| 72 | +If you're a Copilot Business or Enterprise user, your administrator needs to enable this model for your organization. Your administrator can opt in to editor preview features in the Copilot policy settings on GitHub.com. If you're a Copilot Free user, using this model counts toward your 2,000 free monthly completions. |
| 73 | + |
| 74 | +## Related content |
| 75 | + |
| 76 | +- [Use Next Edit Suggestions in SQL Server Management Studio (Preview)](next-edit-suggestions.md) |
| 77 | +- [Get started with GitHub Copilot in SQL Server Management Studio (Preview)](get-started.md) |
| 78 | +- [Troubleshoot GitHub Copilot in SQL Server Management Studio (Preview)](troubleshoot.md) |
0 commit comments