Tutorial: Load data using T-SQL

Applies to: SQL analytics endpoint and Warehouse in Microsoft Fabric

Now that you know how to build a data warehouse, load a table, and generate a report, it's time to extend the solution by exploring other methods for loading data.

Load data with COPY INTO

  1. From the ribbon, select New SQL query.

    Screenshot of the Home screen ribbon, showing where to select New SQL query.

  2. In the query editor, paste the following code.

    --Copy data from the public Azure storage account to the dbo.dimension_city table.
    COPY INTO [dbo].[dimension_city]
    FROM 'https://azuresynapsestorage.blob.core.windows.net/sampledata/WideWorldImportersDW/tables/dimension_city.parquet'
    WITH (FILE_TYPE = 'PARQUET');
    
    --Copy data from the public Azure storage account to the dbo.fact_sale table.
    COPY INTO [dbo].[fact_sale]
    FROM 'https://azuresynapsestorage.blob.core.windows.net/sampledata/WideWorldImportersDW/tables/fact_sale.parquet'
    WITH (FILE_TYPE = 'PARQUET');
    
  3. Select Run to execute the query. The query takes between one and four minutes to execute.

    Screenshot showing where to select Run to execute your query.

  4. After the query is completed, review the messages to see the rows affected which indicated the number of rows that were loaded into the dimension_city and fact_sale tables respectively.

    Screenshot of a list of messages, showing where to find the number of rows that were loaded into the tables.

  5. Load the data preview to validate the data loaded successfully by selecting on the fact_sale table in the Explorer.

    Screenshot of the Explorer, showing where to find and select the table.

  6. Rename the query for reference later. Right-click on SQL query 1 in the Explorer and select Rename.

    Screenshot of the Explorer pane, showing where to right-click on the table name and select Rename.

  7. Type Load Tables to change the name of the query.

  8. Press Enter on the keyboard or select anywhere outside the tab to save the change.

Next step