SSMS 22.2 shipped last week with GitHub Copilot code completions. I don't mean the chat window. I mean inline completions. You type, it finishes — comments and code. I'll agree with Erin Stellato in that they exceed the concept of "IntelliSense on steroids".
In December I made peace with Copilot, but trust is another thing entirely. So yesterday I began testing it with four simple DBA tasks, grading each based on the results. The tool both impressed me and concerned me in places I did not expect.
Before You Start
Code completions require SSMS 22.2.1 or later. If you're on 22.1, you have Copilot Chat but not completions — and nothing will happen when you type. Save some time and check Help\About first. You also need a GitHub account with Copilot access. The free tier gives you 2,000 completions per month. Install walkthrough is here.
How It Actually Works
This isn't a chatbot. You type something into the query editor, pause, and gray ghost text appears. Press Tab to accept. Then Enter, pause, Tab again. Completions come in chunks — a line or two at a time, not the whole query at once. The rhythm is Tab-Enter-pause-Tab-Enter-pause. It's a little clunky at first, but it doesn't take long to find the groove.
Two things that aren't obvious until you sit down with it: Copilot reads your connected database schema to make suggestions, and it seems to read every open query tab for context. Both of those will matter below.
The Report Card
Test 1: The Comment Prompt — Grade: B-
I typed this comment and let Copilot build the query:
-- show all user databases ordered by size in MB
After I typed 'MB' — before I hit Tab or Enter — Copilot suggested SELECT in gray beneath the comment. I then hit Tab to accept, Enter to advance, next chunk appears. Tab, Enter, Tab, Enter — each round added a line or two until I had this:
-- show all user databases ordered by size in MB
SELECT
name AS DatabaseName,
size * 8 / 1024 AS SizeMB
FROM sys.master_files
WHERE type_desc = 'ROWS'
AND database_id > 4
GROUP BY name, size
ORDER BY SizeMB DESC;
It ran very fast and completed without error — but the results are wrong. The query filters to type_desc = 'ROWS', which means only the data files. Log files are excluded. So 'SizeMB' isn't the database size, it's the data file size. I asked for database size and received only the size of the data files.
I ran the same test a second time. Same comment, same instance, different query window. This time it dropped the GROUP BY and the system database filter - which returned all system databases as well. Same input, different output, still wrong.
Then I closed all query windows and opened up a new one. I typed only "-- l" and Copilot returned this:
-- list all databases and their sizes in MB, sorted by size descending SELECT d.name AS DatabaseName, SUM(m.size) * 8 / 1024 AS SizeMB FROM sys.master_files m INNER JOIN sys.databases d ON m.database_id = d.database_id WHERE d.database_id > 4 GROUP BY d.name ORDER BY SizeMB DESC;
There it is! That one is correct! And I got the 'sorted by size descending' in the comments and output as a nice add-in.
This is really very interesting. I honestly was going to type 'list...' rather than the 'show...' that I used in the first two tries. How did Copilot interpret 'l' as 'list' ? I don't know that yet, but this may suggest it's a matter of usage. Maybe as I learn it, I will have more control over the unexpected results? Anyhoo... Third time is the charm. I'll give it a B-.
Test 2: The Schema Finish — Grade: C
I started typing a SELECT and paused briefly. Copilot completed the line:
SELECT name, database_id,
I hit Tab to accept, then Enter, and Copilot returned an unrequested CASE statement remapping state_desc values — 'ONLINE' to 'Online', 'SUSPECT' to 'Suspect' — formatting values that are already human-readable:
But why? I backed out, tried again, and got something completely different:
SELECT name, database_id,
CAST(size * 8 / 1024 AS DECIMAL(10,2)) AS SizeMB,
state_desc
FROM sys.master_files
WHERE type_desc = 'ROWS'
AND database_id > 4
ORDER BY SizeMB DESC;
The CASE disappeared. The query simplified itself. It also borrowed heavily from the query we ran in Test 1. Is Copilot reading the open query windows or referencing previous calls for context? Hard to say just yet.
Graded a C. The final output was usable, but the query path wasn't repeatable.
Test 3: The Boilerplate Machine — Grade: C-
I typed two words twice. First with my other query windows still open, then with them all closed.
BEGIN TRY
With other query tabs open:
BEGIN TRY
BEGIN TRANSACTION
CREATE DATABASE kgkwobci;
USE kgkwobci;
CREATE TABLE dbo.SampleTable (
ID INT PRIMARY KEY,
Name NVARCHAR(50),
CreatedDate DATETIME DEFAULT GETDATE()
);
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
RAISERROR('An error occurred while creating the database and table.', 16, 1);
END CATCH
I typed 'BEGIN TRY' and Copilot invented a database called kgkwobci and wrote a deployment script nobody requested. Creative, I guess. So I tried it again.
With all other tabs closed:
BEGIN TRY
EXEC sp_WhoIsActive
@filter = 'login_name',
@filter_type = 'LIKE',
@not_filter = 'sa',
@show_own_spid = 1,
@show_sleeping_spids = 1,
@get_full_inner_text = 1,
@get_plans = 1,
...
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage;
END CATCH;
Now that is interesting. Copilot reached into my instance, found sp_WhoIsActive installed there, and generated a full execution with nearly every parameter. I didn't ask for monitoring — I just typed 'BEGIN TRY.'
This tells me that Copilot can write solid error handling and it is scanning my installed stored procedures, not just system objects, to generate output. Again, hard to say why just yet. Clearly I need to read up a bit and strengthen my familiarity.
C- because the TRY CATCH was genuinely good error handling. I just don't know how I got there.
Test 4: The Danger Zone — Grade: C+
I connected to my BlitzTest database with an Orders table with one million rows, and typed this:
-- delete all records older than 90 days
Before I even pressed Enter, Copilot appended from dbo.Orders to the comment line. It derived the schema name and table name on its own. I hit Tab then Enter, and produced this:
-- delete all records older than 90 days from the Orders table DELETE FROM dbo.Orders WHERE Created < DATEADD(DAY, -90, GETDATE());
Schema-aware. Correct column name. Correct date math. Syntactically perfect.
Operationally reckless.
No transaction. No batching with TOP. No row count check. No 'are you sure?' safety check. Just a straight, single-transaction DELETE against a million-row table. A DBA with quick fingers and a Tab key could fire that on a production server before their coffee kicks in. If the log file can't absorb a million-row delete in one shot, we may have a problem.
Copilot knew the table, the column, and the syntax. It did exactly what I told it to do. So again, maybe this is usage. The savvy DBA is going to ask for the necessary safety measures when talking to Copilot.
And I really dig how it derived all of that by itself. I gave it a C+.
The Scorecard
| Test | Grade | Notes |
|---|---|---|
| Comment Prompt | B- | Fast. Ran clean. Results were wrong. |
| Schema Finish | C | Overbuilt, then simplified. Borrowed from open tabs. |
| Boilerplate | C- | Good structure. Unexpected content. |
| Danger Zone | C+ | Correct syntax. No safety net. |
| Overall | C |
The Verdict
I am keeping Copilot's code completions turned on. They're fast, they're schema-aware, and for the stuff you already know how to write but don't feel like typing, they save real time. This is a tool worth learning.
But it's still the intern from December. It hands you something that's 70% there. The code will compile and even run. Whether you should run it just yet — that's your call. There is a learning curve and no room for haste. A quick Tab-Enter on the wrong suggestion could go the wrong way fast.
Learn the tool. Use the tool. But read every line before you hit Execute.
More to Read:
Announcing GitHub Copilot Code Completions in SSMS 22.2.1 — Erin Stellato
Code Completions — GitHub Copilot in SSMS — Microsoft Learn
I Just Don't Understand Why You Don't Update SSMS — Brent Ozar
Get Started with GitHub Copilot in SSMS — Microsoft Learn

