key if one does not already exist CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'S0me!nfo' ; -- Create a database scoped credential with Azure storage account key as the secret. CREATE DATABASE SCOPED CREDENTIAL AzureStorageCredential WITH IDENTITY = '<my_account>' , SECRET = '<azure_storage_account_key>' ; -- Create an external data source with CREDENTIAL option. CREATE EXTERNAL DATA SOURCE MyAzureStorage WITH ( LOCATION = 'wasbs://
[email protected]/' , CREDENTIAL = AzureStorageCredential , TYPE = HADOOP ) -- Create an external file format CREATE EXTERNAL FILE FORMAT MyAzureCSVFormat WITH (FORMAT_TYPE = DELIMITEDTEXT, FORMAT_OPTIONS( FIELD_TERMINATOR = ',', FIRST_ROW = 2) --Create an external table CREATE EXTERNAL TABLE dbo.FactInternetSalesNew WITH( LOCATION = '/files/Customer', DATA_SOURCE = MyAzureStorage, FILE_FORMAT = MyAzureCSVFormat ) AS SELECT T1.* FROM dbo.FactInternetSales T1 JOIN dbo.DimCustomer T2 ON ( T1.CustomerKey = T2.CustomerKey ) OPTION ( HASH JOIN );