Getting Started with the MSSQL AI Agent in VS Code

Recently I was working in VS Code and I saw a walkthrough for the new Copilot chat features. I decided to give those a try in trying to get some information from my SQL Server instance.

This post walks through a few things I did with this GenAI agent. There is a video walkthrough at the end.

Note: I have copilot access set on VS Code as a part of my employer’s benefit.

This is part of a series of experiments with AI systems.

First Steps

When I start VS Code, I see something like this.

2025-08_0105

One of the Walkthroughts recently mentioned copilot. If I click the “More” at the bottom right, I’ll get this image. You might see something different, but Id’ expect you have a Copilot walkthrough if you can use Copilot. I choose the 4th one down (where the mouse pointer is).

2025-08_0106

This opened a Copilot pane. There were a few items, and you can see on the left in the image below, some have checkmarks. I’d explored these before.

2025-08_0107

If I scroll up, I see the one I wanted to get, which was “chat about your code”. I picked this one. This opened a blade to the left when I clicked the blue “Chat with Copilot” button.

2025-08_0109

I had read there are these @ agents (look up at the right side) and decided to type “@”. I saw a list of things.

2025-08_0110

Lots of places to work, but I choose the @mssql agent, since this is the place I tend to work. In the lower pane, I typed a question.

2025-08_0111

Above this (still in the left blade), I got a response.

2025-08_0112

Below this, I got some text and code explaining how to access a list of databases on various platforms. Not sure why MySQL is first, but I’m assuming this is alphabetical. For SQL Server, I saw this. This is a reasonable answer, with some help on how to execute it.

2025-08_0113

I then decided to connect to my local instance. I have the MSSQL extension, so I clicked that and got a connection.

2025-08_0114

Rerunning that query produced the same response. However, when I opened a query window, I got different results. Note the little database icon on the left, below my prompt, with “Untitled-1” next to it. This is the context, which I also saw added to the lower prompt box, just above where I would enter a prompt.

2025-08_0115

However, this didn’t work.  After a few minutes,  I got this.

2025-08_0116

and this. The LLM is trying, but can’t seem to get a query to run. It did try.

2025-08_0119

I then decide to move on.

Getting Results Back from Questions

This isn’t really the type of thing I’d do, but I decided to try and get some info from a database. The one above isn’t that interesting, so I switched to asking the model some questions. Here’s the first one, where I don’t remember the exact table name, but I ask.

2025-08_0120

It’s queried the database, and there isn’t a player table. However, it continues to look and finds dbo.players.

2025-08_0121

Even better, once it has the answer, it also provides a little more info. Maybe good, maybe bad. This reminds me of talking with a person that gives me more information than I asked for.

2025-08_0122

I try something else. Let’s get some metadata, since I clearly don’t remember what’s in this database.

2025-08_0125

I get a nice response, with some guesses about what information is contained inside these tables.

2025-08_0126

OK, can I query for information. I’ve always been a bit more of a hitter than a pitcher, so I’ll ask a question. This isn’t asking to join specific tables, but get me an answer.

2025-08_0127

It worked, though to be fair, I tabbed over to SSMS and wrote this query in the same time (with SQL Prompt) as the Copilot agent. Cool to see as I’d forgotten Thome and Vlad were up there.

2025-08_0134

While I got the answer, I didn’t get the query. I asked for it and got it, with an apology.

2025-08_0128

I’ll do something else. Who played the longest. Might be a somewhat funny query to write for a quick answer. I’d have to join a few tables and look for a sum.

2025-08_0130

It likely remembered I wanted the query, so that was included, with an explanation. However, it only looked at the batting table.

I asked other questions about fielding and pitching and got those answers (Nolan Ryan, 27 years with fielding stats and pitching stats. So I asked that:

2025-08_0151

Below this, I see the two players who tied, which Copilot noted.

2025-08_0152

The code provided only returned one player. I checked, which is something that you should always do. I asked if I could get better code. I got a few options, and I liked the RANK one, so I tried it and it worked.

2025-08_0180

Slightly annoying, but when I think about this type of conversation with someone else, especially a junior dev, I might have the same results and iterate this way.

At this point I also asked about databases, and I got a result. Maybe I needed a query to run first? Not sure why this works now.

2025-08_0133

Summary

This was an interesting set of things I could get done with this agent in VS Code. It’s not amazing, but it was helpful. I could tackle some light query tasks or db query ones while also handling some other work. In this case I wasn’t in the zone, trying to code or decode a database schema. Instead, I had a few things to try, and I let the agent work while I tabbed over to close some emails and chats.

In a job where I might need to find info from an unfamiliar database, this could be helpful in getting things done, though it’s hard to know if it’s slower for me if I were focused on ths all the time. The agent can find some info without me, but it also failed in a few cases. I started to try and get other things done when I noticed delays in responding and some hung queries.

Learning to use an AI agent to help you is a skill, and it’s one that takes time to develop.

I’ll look at some more practical tasks in the next post.

Video Walkthrough

Here’s a video walkthrough of most of the stuff in this post. It differs slightly as working with LLMs is not deterministic.

Posted in Blog | Tagged , , | 2 Comments

Requiring Technical Debt Payments

I was working with a customer recently that is trying to improve their processes. This was a large company, over 100,000 employees, though most of them aren’t in the technology area. However, across many divisions and groups, there are a lot of developers and operations personnel who have tended to work in silos, managing their own applications and systems in disparate ways.

In other words, doing software development the way most companies do it.

I had been working with one group to streamline and standardize some of their software practices to implement more of a DevOps flow to smoothly build, operate, and update their systems. They’ve had some success and other groups noticed that this set of teams is very efficient. They aren’t DevOps like a lot of the articles you read. They still have development and operations, but the groups work closely to ensure efficiency.

They started to get requests to onboard other teams into their flow as the management of this group has been advertising their success. Other groups want to implement Continuous Integration, get database unit testing and static code analysis setup, implement gates for approval, and more. The Operations team manages most of this and is happy to help other groups.

But

They require some things to be in place, some of which are cleaning up technical debt. Not all debt, but certain things that create additional risk or instability. Before they onboard anyone, they don’t want to take on a codebase that is difficult to manage. A lot of this debt isn’t difficult, but they want some good coding practices implemented. They require integrated security or a waiver from InfoSec. They want explicit index names, not system-generated ones. They want permissions granted to roles, not users. Not big things, but little items that make a system less maintainable and understandable.

The same things a lot of us let creep into our codebase over time.

On one hand, I thought this was an idea that would slow adoption and allow many groups to continue to operate inefficiently. They won’t clean up code. On the other hand, this might be the lever that helps create a better run environment across the organization. This might help them smooth their upgrade cycles, let staff change between projects, and more importantly, reduce the overhead of communication and work between teams.

I don’t know how this will work over time, but I am interested to see what happens.

Steve Jones

Listen to the podcast at Libsyn, Spotify, or iTunes.

Note, podcasts are only available for a limited time online.

Posted in Editorial | Tagged , , | Comments Off on Requiring Technical Debt Payments

Learning a New Language

This week, there are two interesting articles in the newsletter. The first is a markdown getting started article, which helps you learn how to format your documents. At first, I wasn’t sure I liked markdown, but I’ve come to prefer it for a lot of documents. It’s easy to use, and it makes using Git for docs very easy. Plus, I can mix in markdown and HTML as needed, which I really appreciate. I think most people who collaborate and update any documents in a team should learn to use markdown instead of Word, Notepad, etc.

The second one that caught me eye is one on Power Query. I don’t know Power Query, but there was a piece on the 13 things John Kerski wishes he knew when he started. I didn’t really do more than skim this since I am not writing any Power Query right now. What was interesting to me is that I’m not sure I’d bookmark this if I were actually writing Power Query in Power BI as part of my job.

Maybe I would, but as I start to use a GenAI more and more to get me started with different projects or requirements, I’m finding it as a way to kickstart me in learning something new. It’s not perfect, and I have to test the results I get. Learning to judge the quality is part of my job, but that’s different than trying to learn something new from scratch. That’s a similar view to what I’ve heard from a few people. This podcast with Kent Beck showcases this view (starts at 6:12).

In the real world, when I wanted to learn something new, I often looked for a book or a few magazine articles that might get me some basics in a new area. In the digital world, I used to do the same thing, but in the last 20 years, I’ve been looking for an article or a “start in 30 days” book that might give me some basic skills. Then I could experiment and extend what I learned to get work done, likely asking friends or someone in a forum how to do the thing I need.

Now I ask a GenAI and go from there. I no longer worry about learning the specifics of a language, as I have a good idea in general of the things I need to do. What I’m using the GenAI to do is implement some details, and then I go back and check things. It’s like having an intern who can do a first draft while I work on something else.

Except it’s way faster.

GenAI models aren’t perfect, and they make mistakes. However, the more I use them, the more I enjoy them, and I find enough small time savings that I want to use them more.

Steve Jones

Posted in Editorial | Tagged , | 1 Comment

Guidelines and Requirements

I saw a post from Brent that Microsoft had changed the default memory guidance. At first glance I read this as they’d changed the default values, which would be interesting. However, this is a guideline, set to 75%. I also saw a few thoughts from Randolph West on LinkedIn, and quite a few comments. The comments were interesting in a few ways.

It is easy to look at 75% and say that won’t work for this server that’s on my mind right now because I keep getting woken up. That might be true. However, the 75% number isn’t a hard requirement. It’s a guideline, a recommendation to ensure you have enough memory for the OS, but you’re trying to use most for SQL Server. Feel free to adjust it if you feel the need.

There are certainly people who will also look at that number and then go to a DBA and say, “you’ve set this to 70% (or 85% or whatever) and that’s not what Microsoft says.” Which isn’t true. What the text says is this under the recommended column: “75% of available system memory not consumed by other processes, including other instances. For more detailed recommendations, see max server memory

If you go to the “max server memory” section, you see something else. It asks you to monitor before you set this, then do some calculations. Then it says: “This is a generic approximation, and your mileage might vary.”

That’s a great statement. What they’ve written might not work for you. That’s true. Maybe you have little RAM and some other stuff on your server, so 75% might be way too high. Maybe you have 4TB of RAM, in which case, if you blindly set 75% you should be asked to work elsewhere. Anyone managing systems with 4TB of RAM should know how to monitor, measure, and then choose something different, which might be 85% of RAM.

While there might be some requirements for managing database systems, there really are a lot of guidelines. You have to make decisions, which means you need some knowledge on which to make good decisions. If you don’t have that knowledge, or are unsure, ask others, ask the GenAI’s, conduct experiments, test things. That’s the job. Learn what you need to make things run better.

Better being what your clients need, want, and desire.

Steve Jones

Listen to the podcast at Libsyn, Spotify, or iTunes.

Note, podcasts are only available for a limited time online.

Posted in Editorial | Tagged | Comments Off on Guidelines and Requirements