Tutorial: Load data with T-SQL into a Warehouse

Applies to: ✅ Warehouse in Microsoft Fabric

In this tutorial, learn how to load data from a public storage Azure Blob storage account into Warehouse tables with T-SQL.

Note

This tutorial forms part of an end-to-end scenario. In order to complete this tutorial, you must first complete these tutorials:

  1. Create a workspace
  2. Create a Warehouse
  3. Ingest data into a Warehouse
  4. Create tables with T-SQL in a Warehouse

Load data with T-SQL

In this task, learn to load data with T-SQL.

  1. Ensure that the workspace you created in the first tutorial is open.

  2. On the Home ribbon, select New SQL query.

    Screenshot of the Home ribbon, highlighting the New SQL query option.

  3. In the query editor, paste the following code. The code copies data from Parquet files sourced from an Azure Blob storage account into the dimension_city table and fact_sale table.

     --Copy data from the public Azure storage account to the dimension_city table.
     COPY INTO [dbo].[dimension_city]
     FROM 'https://fabrictutorialdata.blob.core.windows.net/sampledata/WideWorldImportersDW/tables/dimension_city.parquet'
     WITH (FILE_TYPE = 'PARQUET');
    
     --Copy data from the public Azure storage account to the fact_sale table.
     COPY INTO [dbo].[fact_sale]
     FROM 'https://fabrictutorialdata.blob.core.windows.net/sampledata/WideWorldImportersDW/tables/fact_sale.parquet'
     WITH (FILE_TYPE = 'PARQUET');
    
  4. On the query designer ribbon, select Run to execute the query.

    Screenshot of the Run option on the query editor ribbon.

  5. When the script execution completes, review the messages to determine how many rows were loaded into the dimension_city table and fact_sale table.

  6. To load a preview of the loaded data, in the Explorer pane, select fact_sale.

    Screenshot of the Explorer pane, highlighting the fact sale table.

  7. Rename the query as Load Tables.

Next step