Connect to Synapse SQL with Visual Studio and SSDT
Use Visual Studio to query dedicated SQL pool using Azure Synapse Analytics. This method uses the SQL Server Data Tools (SSDT) extension in Visual Studio 2019.
Note
Serverless SQL pool support requires at least VS2022 17.7 see the release notes: Support for Serverless Sql Pool.
Prerequisites
To use this tutorial, you need to have the following components:
- An existing Synapse workspace, If you need to create one see Creating a Synapse workspace
- A dedicated SQL pool. If you do not have one, see Create a dedicated SQL pool.
- SSDT for Visual Studio. If you have Visual Studio, you probably already have this component. For installation instructions and options, see Installing Visual Studio and SSDT.
- The fully qualified SQL server name. To find this server name, see Connect to a dedicated SQL pool.
1. Connect to a dedicated SQL pool
Open Visual Studio 2019.
Open the SQL Server Object Explorer by selecting View > SQL Server Object Explorer.
Click the Add SQL Server icon.
Fill in the fields in the Connect to Server window.
- Server name: Enter the server name previously identified.
- Authentication: Select SQL Server Authentication or Active Directory Integrated Authentication:
- User Name and Password: Enter your user name and password if SQL Server Authentication was selected above.
- Click Connect.
To explore, expand your Azure SQL server. You can view the databases associated with the server. Expand AdventureWorksDW to see the tables in your sample database.
2. Run a sample query
Now that a connection has been established to your database, you'll write a query.
Right-click your database in SQL Server Object Explorer.
Select New Query. A new query window opens.
Copy the following T-SQL query into the query window:
SELECT COUNT(*) FROM dbo.FactInternetSales;
Run the query by clicking the green arrow or use the following shortcut:
CTRL
+SHIFT
+E
.Look at the query results. In this example, the FactInternetSales table has 60398 rows.
Next steps
Now that you can connect and query, try visualizing the data with Power BI. To configure your environment for Microsoft Entra authentication, see Authenticate to dedicated SQL pool.