I have an Azure SQL managed instance and would like to read pdf files(images) from Azure blob storage with openrowset. I'm able to read single file when I specify pdf file names but to read multiple files I'm getting an error.
code:
CREATE DATABASE SCOPED CREDENTIAL CREDENTIAL123
WITH IDENTITY ='SHARED ACCESS SIGNATURE',
SECRET='xxx'
CREATE EXTERNAL DATA SOURCE DS
WITH (
TYPE=BLOB_STORAGE,
LOCATION='https://xxx.blob.core.windows.net/container-backup',
CREDENTIAL = CREDENTIAL123
);
Read single pdf image file:
SELECT BulkColumn FROM Openrowset(
Bulk 'doct_testing/3js-D-Report.pdf',
DATA_SOURCE ='DS',
Single_Blob) ImageData
Output: BulkColumn: 0x312457443823
Read multiple pdf image file
SELECT BulkColumn FROM Openrowset(
Bulk 'doct_testing/*.pdf',
DATA_SOURCE ='DS',
Single_Blob
) ImageData
Output:
Cannot bulk load. The file "https://xxx.blob.core.windows.net/container-backup/doct_testing/*.pdf" does not exist or you don't have file access rights.
SECRET is having FULL rights to read all the pdf files. If I specify the pdf names manually it's reading all the pdf files but when I use *.pdf it's throwing an error.