MS SQL with VS Code + GitHub Copilot
By Mike Irving - Published: 3/8/2025

A colleague recently expressed a few frustrations with SQL Server Management Studio (SSMS), particularly it being slow to load, and the need to throw away all their work-in-progress tabs on exit.

 

I thought I'd look into an alternative.

 

Initially I looked at Azure Data Studio. It has the advantage of being able to connect to other database types, such as MySQL, PostgreSQL, and Cosmos DB. However, it is being retired in February 2026, so I didn't want to explore that any further.

 

Visual Studio Code

I then deduced that I didn't really want another heavy install, so I turned my attention to the world's most used code editor - Visual Studio Code, or "VS Code" for short.

 

Getting Started is easy, simply search for and install the SQL Server (mssql) Extension from the Extensions Marketplace in VS Code.

SQL Server (mssql) Extension

 

Alternatively, find the Extension on the Visual Studio Marketplace, here.

 

Once installed, you will be presented with a Quick Start splash screen.

SQL Server Extension splash screen

 

Connecting to a database is straightforward, and very like SSMS.

Specify your Server name, or Browse Azure, and then specify your Authentication details.

Connect to Database screen

 

Upon successful connection, you can find your Connection, Browse Databases, run a Query and get some results, in a manner not dissimilar to SSMS.

Server Explorer, Query and Results

 

GitHub Copilot

Now the interesting bit, let's use GitHub Copilot to help us Query our database.

Open the GitHub Copilot Chat, and away we go with a task or question.

We will task GitHub Copilot with creating a Query for us.

GitHub Copliot - ask to create query

Of course it will need help. It is conversational, so carry on chatting.

Further Query Chat Conversation

Copilot confirms the Query creation in the chat, and identifies some potential errors.

Chat reports Query Created, with errors

Here's the created Query, along with alternatives. You can see the Name and Description column names are wrong, perhaps due to my information not being specific enough.

Created Query, with Errors

Let's give Copilot the correct column names in the Chat.

Give Copliot the correct Column Names

GitHub Copilot corrects the query, and reports the setup in the Chat.

Copliot corrects the Query

Checking the results of the Query now, we can see we have our desired Name and Description data included.

Results of the Query

 

We can go further with this. Let's ask GitHub Copilot to turn this into a Stored Procedure.

Ask Copilot to turn this into a Stored Procedure

Voila, we have a Create Procedure definition.

Create Procedure definition

 

Of course, it's up to you how far you go with this. GitHub Copliot is there to assist.

As we're in Visual Studio Code, we can flip between SQL tabs and our Code tabs at will, with Copilot poised to help.

 

We can also change the model that GitHub Copilot will use.

I found certain models were better than others in this SQL Server context.

GitHub Copilot - change model

 

As we're in VS Code, we can also very easily terminate the program, with our tabs restored when we reopen!

Visual Studio Code Tabs

 

Further Reading:

Microsoft Learn - MSSQL Extension for VS Code

GitHub Copilot in VS Code


View Blog Entries...
Page: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11