使用 SQL Server Management Studio (SSMS) 连接到 Azure Synapse Analytics 中的专用 SQL 池Connect to a dedicated SQL pool in Azure Synapse Analytics with SQL Server Management Studio (SSMS)

使用 SQL Server Management Studio (SSMS) 连接到 Azure Synapse 中的数据仓库并进行查询。Use SQL Server Management Studio (SSMS) to connect to and query a data warehouse within Azure Synapse.

先决条件Prerequisites

要使用本教程,需要:To use this tutorial, you need:

1.连接到专用 SQL 池1. Connect to your dedicated SQL pool

  1. 打开 SSMS。Open SSMS.

  2. 选择“文件” > “连接对象资源管理器” ,打开对象资源管理器。Open Object Explorer by selecting File > Connect Object Explorer.

    SQL Server 对象资源管理器

  3. 填写“连接到服务器”窗口中的字段。Fill in the fields in the Connect to Server window.

    连接到服务器

    • 服务器名称Server name. 输入前面标识的 服务器名称Enter the server name previously identified.
    • 身份验证Authentication. 选择“SQL Server 身份验证” 或“Active Directory 集成身份验证” 。Select SQL Server Authentication or Active Directory Integrated Authentication.
    • “用户名” 和“密码” 。User Name and Password. 如果上面选择了 SQL Server 身份验证,请输入用户名和密码。Enter user name and password if SQL Server Authentication was selected above.
    • 单击“连接” 。Click Connect.
  4. 要浏览,请展开 Azure SQL 服务器。To explore, expand your Azure SQL server. 可以查看与服务器关联的数据库。You can view the databases associated with the server. 展开 AdventureWorksDW 以查看示例数据库中的表。Expand AdventureWorksDW to see the tables in your sample database.

    浏览 AdventureWorksDW

2.运行示例查询2. Run a sample query

现在,已建立了与数据库的连接,接下来让我们编写查询。Now that a connection has been established to your database, let's write a query.

  1. 在 SQL Server 对象资源管理器中右键单击数据库。Right-click your database in SQL Server Object Explorer.

  2. 选择“新建查询” 。Select New Query. 此时将打开一个新的查询窗口。A new query window opens.

    新建查询

  3. 将以下 T-SQL 查询复制到查询窗口中:Copy the following T-SQL query into the query window:

    SELECT COUNT(*) FROM dbo.FactInternetSales;
    
  4. 单击 Execute 或使用以下快捷方式即可运行查询:F5Run the query by clicking Execute or use the following shortcut: F5.

    运行查询

  5. 查看查询结果。Look at the query results. 在此示例中,FactInternetSales 表包含 60398 行。In this example, the FactInternetSales table has 60398 rows.

    查询结果

后续步骤Next steps

若要为 Azure Active Directory 身份验证配置环境,请参阅向 SQL 池进行身份验证To configure your environment for Azure Active Directory authentication, see Authenticate to SQL pool.