Connect and query
Quickstart: Connect to and query a database In this quickstart, you learn how to use the MSSQL extension for Visual Studio Code to connect to a database, whether it's running locally, in a container
Quickstart: Connect to and query a database
In this quickstart, you learn how to use the MSSQL extension for Visual Studio Code to connect to
a database, whether it’s running locally, in a container, or in the cloud. Then you learn how to use
Transact-SQL (T-SQL) statements to create a database, define a table, insert data, and query
results.
To complete this quickstart, you must have:
: If you don’t have Visual Studio Code installed, download and install it
from the
official Visual Studio Code website.
: In Visual Studio Code, open the Extensions view
by selecting the Extensions icon in the Activity Bar on the side of the window. Search for
and select
to add the extension.
: If you don’t have access to a database instance, you can use one by
selecting one of the following options:
: Run SQL Server in a Docker container for easy setup and
portability. For more information, see
Quickstart: Run SQL Server Linux container images
with Docker.
: If you prefer a cloud-based option, create a free Azure account and
set up an Azure SQL Database. For more information, see
Quickstart: Create a single
database - Azure SQL Database.
SQL database in Fabric
: If you need an autonomous, and secure, and optimized for AI
database, create a SQL database in Fabric. For more information, see
Create a SQL
database in Microsoft Fabric.
: Alternatively, download and install SQL Server 2022 Developer Edition
on your local machine. For more information, see
Microsoft SQL Server website.
mssql