sqlsql-serverazureclrbulk-import

How to import Azure blob file into Sql Server 2008


Is there a way to import Blob files into sql server 2008 other than using CLR ?

The file size is around 300MB so CLR isn't efficient enough. Is there a possibility to use BULK INSERT or OPENROWSET in 2008 server?

Example in Sql Server 2017 we can do this

CREATE DATABASE SCOPED CREDENTIAL AzureDevBlobImportCred
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = 'st=2018-12-05T.....'

go

CREATE EXTERNAL DATA SOURCE AzureDevBlobImportExternalSrc
WITH  (
    TYPE = BLOB_STORAGE,
    LOCATION = 'https://myStorageAccount.blob.core.windows.net', -- storage account URL
    CREDENTIAL = AzureDevBlobImportCred -- External Data Source
);

then we can use the external data source in bulk import

BULK INSERT #Mytemptable 
FROM 'filename'
WITH (DATA_SOURCE = 'AzureDevBlobImportExternalSrc'
); 

So do we have something like above to import blob files in Sql Server 2008 ?


Solution

  • Look at the document:BULK INSERT (Transact-SQL).

    SQL Server 2008 supports BULK INSERT: starting with 2008. enter image description here So you can use BULK INSERT in SQL Server 2008.

    But if you data_file is in Azure blob storage, your SQL Server version must begin with SQL Server 2017 (14.x) CTP1.1. The same with OPENROWSET. enter image description here

    It means that you could not import Blob files into SQL Server 2008 with BULK INSERT or OPENROWSET.

    Hope this helps.