Visual Studio Code

You know how life gets busy and you never seem to have any time for smaller projects? Well, am I ever grateful to Julie Andreacola who reminded me about Visual Studio Code while we were at the Midwest Management Summit (MMSMOA) in Minnesota earlier this year. She said, “Hey Garth! Didn’t you want to check out Visual Studio Code?” “Of course,” I said, “It’s been on my list for a long, long time.”

Why am I looking at it? There are two main reasons. First, it is a great replacement for PowerShell ISE. Second, it is also a great replacement for SQL Server Management Studio (SSMS). Plus, I’m just trying to be current by, “keeping up with the times.”

Want to get started with Visual Studio Code too? Then follow along as I show you where to find it, how to install it, how to install the MSSQL extension and then how to get started using it with SQL Server.

Where Do You Get Visual Studio Code?

You can download the User Installer directly from the home page, https://code.visualstudio.com/, where the download picks the correct OS for you.

If you are like me, however, with Windows you want installer options. In this case: User Installer or System Installer. You can download either from this link: https://code.visualstudio.com/download.

In this blog post, I use System Installer for my example.

Installing Visual Studio Code

Visual Studio Code - Setup Wizard

Start by double-clicking on the setup file and then click Next on the welcome screen.

Visual Studio Code - License Agreement

Select, I accept the agreement, and then click Next.

Visual Studio Code - Location

Accept the default install location and click Next.

Visual Studio Code - Start Menu Folder

Accept the Start Menu folder name and click Next.

Visual Studio Code - Additional Tasks

At this step, I selected the Create a desktop icon option and then I clicked on Next.

Visual Studio Code - Install

Click Install.

Visual Studio Code - Finish

Finally, click on the Finish button.

Installing the MSSQL Extension

Visual Studio Code - Welcome Screen

From the Welcome screen, click on the Extensions button (purple arrow).

Visual Studio Code - Extensions - MSSQL

In the search area type mssql.

Visual Studio Code - MSSQL - Install

Select SQL Server (mssql) and then click on Install in order to start the installation process.

Visual Studio Code - MSSQL - Installing

<Wait>

Visual Studio Code - MSSQL - Installation Complete

About a minute or two later, the installation of SQL Server (mssql) is completed.

Getting Started with SQL Server and Visual Studio Code

Visual Studio Code - Select Language Mode

Open a new file. Now, type Ctrl-K followed by the letter M. Doing this action opens the Select Language Mode.

Visual Studio Code - SQL

Type sql and select SQL.

Visual Studio Code - Database Icon

Once you select SQL, notice that your icon changes to a database icon.

Visual Studio Code – First Impressions

Wow, there’s a bit of a learning curve with Visual Studio Code. I can now see, though, the appeal of having one tool to rule them all.

It’s nice to finally be able to create a SQL Server connection string, server name and database name all from one tool. The SQL Server connection string feature is great because once you determine the database, you don’t need to remember to change it from the master to your SCCM database. You can start using it right away! This also means that you no longer get the error, “Invalid object name,” that you would see in SQL Server Management Studio (SSMS).

Unfortunately, I found creating the connection string a bit difficult at first because it was hard to find. Below are the steps that I took to find it.

Visual Studio Code - Create Connection Profile

Press Ctrl-Shift-C in order to expose the Create Connection Profile wizard (see above).

Visual Studio Code - Query

IntelliSense is also a wonderful feature with Visual Studio Code, but in my opinion, it misses the mark by not following good TSQL query practices. I say this because it does NOT add the database owner (dbo) to the query automatically.

I like the Execute button in SSMS, but in Visual Studio Code I need to press Ctrl-Shift-E in order to execute queries. That might seem like a small issue to you, but it’s the little things that can make for a good user experience.

Before I render a final judgement on Visual Studio Code, I will devote more time to using it. As I mentioned earlier, there is a learning curve, so once I feel more comfortable with it, I’ll let you know what I think!

Are you looking for FAQs about Visual Studio Code? Then please see this page: https://code.visualstudio.com/docs/supporting/faq. The big one to note is that Visual Studio Code is free to use, https://code.visualstudio.com/license.

If you have any questions about Visual Studio Code, please feel free to contact me at @GarthMJ.

Leave a Comment