Thursday, November 17, 2016

Creating & Executing SQL Queries in Visual Studio Code

Visual Studio Code is a modern, lightweight (but powerful) source code editor which runs on your desktop and is available for Windows, Mac, and Linux.

A new extension has been announced which would support creating and executing SQL queries from within Visual Studio code editor.

Setting up the environment:

1. Download and install Visual Studio code from here -
2. Next you need to install the extension "mssql" on it. Refer the steps here in GitHub  or Microsoft Documentation

As explained in the above link bare minimum these steps should have been completed:

  • Installation of Visual studio code and mssql extension
  • Creating the SQL Server Connection Profile
  • Changing the language of the file to "SQL"

Executing the query:

1. It's simple, just type the query you want and to execute it press "CTRL + SHIFT + e"
2. Results can also be saved as a .csv, .json file

Sample output:

No comments: