Azure SQL Database
An Azure relational database service.
5,754 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
Is it possible to read a file that is on Azure Data Lake Gen 2 Storage account from an T-SQL query on Azure SQL Database?
Thanks
I think all you need can be found on this article.
Alternatively you can use OPENROWSET.
CREATE EXTERNAL DATA SOURCE pocBlobStorage
WITH ( TYPE = BLOB_STORAGE,
LOCATION = 'https://eventhubstore.blob.core.windows.net/datasets',
CREDENTIAL= sqlblob);
-- Query remote file
SELECT *
FROM OPENROWSET(BULK 'currency.csv',
DATA_SOURCE = 'pocBlobStorage',
FORMATFILE='currency.fmt',
FIRSTROW=2,
FORMATFILE_DATA_SOURCE = 'pocBlobStorage') as D
Inner Join [dbo].[State] C
On C.[id] = D.CurrencyKey
This OPENROWSET example works for classic storage accounts for sure but on Azure Data Lake Storage Gen2 accounts there was this reason that prevented from working with Gen2. I last verified this back on 2019.