Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (13.1k points)

I want to create an external table in blob storage which needs to be managed by Azure SQL. Herewith I have attached my script which is throwing error.

My script:

CREATE DATABASE SCOPED CREDENTIAL some_cred WITH IDENTITY = user1,   

    SECRET = '<Key of Blob Storage container>';  

CREATE EXTERNAL DATA SOURCE TEST

WITH

(

    TYPE=BLOB_STORAGE,

    LOCATION='wasbs://<containername>@accountname.blob.core.windows.net',

    CREDENTIAL= <somecred>`enter code here`

);

CREATE EXTERNAL TABLE dbo.test

(

val VARCHAR(255)

)

WITH

(

DATA_SOURCE = TEST

)

I am getting this error:

External tables are not supported with the provided data source type.

Can anyone help me with this?

1 Answer

0 votes
by (26.7k points)

Basically, Azure SQL database can only load files in Blob storage via BULK INSERT and OPENROWSET language features.

BULK INSERT dbo.test

FROM 'data/yourFile.txt'

WITH ( DATA_SOURCE = 'YourAzureBlobStorageAccount');

The way you have scripted is only available in SQL server 2016 and Azure SQL Data Warehouse now.

I hope this will help.

Want to become an Azure expert? join Azure Training now!!

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.5k questions

29.9k answers

500 comments

99.1k users

Browse Categories

...