CREATE EXTERNAL DATA SOURCE

  • Im trying to extract data stored as a csv file in azure blob storage and import it into my main sql database.  When I type this


    CREATE EXTERNAL DATA SOURCE AzureBlobStorage
    WITH (    TYPE = BLOB_STORAGE,
            LOCATION = 'location here',
            CREDENTIAL= MyAzureBlobStorageCredential    
    );

    I get 'Incorrect syntax near EXTERNAL'

    im developing with SQL server express 2012 and my production server is sql server 2012 enterprise.  Is it true that this feature is only available with sql server 2016 ?  If so and upgrading to 2016 is not possible, what are my options for getting at the blob data in azure ?

  • Please remove the Connection String "column encryption setting=enabled" in our SSMS and try it again

  • solus - Wednesday, May 10, 2017 5:57 AM

    Im trying to extract data stored as a csv file in azure blob storage and import it into my main sql database.  When I type this


    CREATE EXTERNAL DATA SOURCE AzureBlobStorage
    WITH (    TYPE = BLOB_STORAGE,
            LOCATION = 'location here',
            CREDENTIAL= MyAzureBlobStorageCredential    
    );

    I get 'Incorrect syntax near EXTERNAL'

    im developing with SQL server express 2012 and my production server is sql server 2012 enterprise

    CREATE EXTERNAL DATA SOURCE was added in SQL Server 2016, so you will get a syntax error in any lower version, the feature's not there.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • One option is to download the file locally then import the file.

    Download can be done via powershell
    https://docs.microsoft.com/en-us/azure/storage/storage-powershell-guide-full

    Or C#
    https://blogs.msdn.microsoft.com/webapps/2014/09/24/upload-and-download-files-from-azure-storage/

  • GilaMonster - Friday, July 21, 2017 3:22 AM

    solus - Wednesday, May 10, 2017 5:57 AM

    Im trying to extract data stored as a csv file in azure blob storage and import it into my main sql database.  When I type this


    CREATE EXTERNAL DATA SOURCE AzureBlobStorage
    WITH (    TYPE = BLOB_STORAGE,
            LOCATION = 'location here',
            CREDENTIAL= MyAzureBlobStorageCredential    
    );

    I get 'Incorrect syntax near EXTERNAL'

    im developing with SQL server express 2012 and my production server is sql server 2012 enterprise

    CREATE EXTERNAL DATA SOURCE was added in SQL Server 2016, so you will get a syntax error in any lower version, the feature's not there.

    Hi Gail,
    For testing purpose, can I use SQL Server 2012 to connect with my SQL Server 2016 where I have setup PolyBase and want to bring data from a database residing on SQL Server 2012?

    I setup the initial work done, PolyBase service is up and running. Executed following:
    1- CREATE MASTER KEY
    2- CREATE DATABASE SCOPED
    3- Getting error on following:
    CREATE EXTERNAL DATA SOURCE SQLServerInstance28
      WITH ( 
       TYPE = MSSQLSERVER,
       LOCATION = 'mySQLServer2012.MyDomain.com',
       DATABASE_NAME = 'MyPolyDB',
       CREDENTIAL = SQLServerCredentials
      )
    ;
    The third script correct parameter  I am missing, that is the only problem right now I am facing.
    It gives following error:

    Incorrect syntax near 'MSSQLSERVER'.

    In case of SQL Server, that "TYPE" parameter is required?

    Shamshad Ali

  • I'm not an Azure user by any means so be gentle, please... Azure doesn't have a BULK INSERT command or OPENROWSET? :blink:

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • It has both, at least according to the docs. Don't have a SQLDB on hand to try.

    https://azure.microsoft.com/en-us/updates/files-from-azure-blob-storage-to-sql-database/
    https://azure.microsoft.com/en-us/updates/preview-loading-files-from-azure-blob-storage-into-sql-database/

    What it doesn't have is a file system (it's a hosted database, not hosted server), so you import from blob storage via an external data source (created with CREATE EXTERNAL DATA SOURCE).

    Edit: That's assuming that by 'Azure', you mean Azure SQLDB and not one of the other myriad of Azure offerings

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster - Monday, December 17, 2018 8:30 AM

    It has both, at least according to the docs. Don't have a SQLDB on hand to try.

    https://azure.microsoft.com/en-us/updates/files-from-azure-blob-storage-to-sql-database/
    https://azure.microsoft.com/en-us/updates/preview-loading-files-from-azure-blob-storage-into-sql-database/

    What it doesn't have is a file system (it's a hosted database, not hosted server), so you import from blob storage via an external data source (created with CREATE EXTERNAL DATA SOURCE).

    Edit: That's assuming that by 'Azure', you mean Azure SQLDB and not one of the other myriad of Azure offerings

    Thanks for the info, Gail.  Much appreciated.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply