Skip to content

Files

Latest commit

4b002df · Jan 17, 2025

History

History
68 lines (47 loc) · 2.36 KB

File metadata and controls

68 lines (47 loc) · 2.36 KB

Load your Azure SQL database with data

sql/load-your-mssql-database-with-data/README.md

Prerequisites

This example assumes you have previously completed the following examples:

  1. Create an Azure Resource Group
  2. Create an Azure SQL Database
  3. Install curl
  4. Open Azure SQL server firewall to your IP address
  5. Install mssql-cli client

Load your Azure SQL database with data

To load the Azure SQL database with data execute the following command lines to connect to the database:

  export MSSQL_DNS_NAME=`az sql server show \
    --resource-group $RESOURCE_GROUP \
    --name $MSSQL_NAME \
    --query fullyQualifiedDomainName \
    --output tsv`

  export MSSQL_CLIENT_USERNAME="$MSSQL_USERNAME@$MSSQL_NAME"

  mssql-cli -S $MSSQL_DNS_NAME -U $MSSQL_CLIENT_USERNAME -P $MSSQL_PASSWORD -i create.sql

  mssql-cli -S $MSSQL_DNS_NAME -U $MSSQL_CLIENT_USERNAME -P $MSSQL_PASSWORD -d demo -i load.sql

Cleanup

Do NOT forget to remove the resources once you are done running the example.

1m