无法在SQL中创建外部数据源

编程入门 行业动态 更新时间:2024-10-26 12:28:59
本文介绍了无法在SQL中创建外部数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试创建一个外部数据源来访问Azure Blob存储.但是,我在创建实际数据源时遇到问题.

I'm trying to create an external data source to access Azure Blob Storage. However, I'm having issues with creating the actual data source.

我已按照此处的说明进行操作: 在azure blob存储中批量访问数据的示例和 创建外部数据源-交易sql .我正在使用Windows身份验证的客户端计算机上通过SSMS访问的VM上使用SQL Server 2016,没有任何问题.说明说,创建此外部数据源适用于SQL Server 2016和Azure Blob存储.

I've followed the instructions located here: Examples of bulk access to data in azure blob storage and Create external data source - transact sql. I'm using SQL Server 2016 on a VM accessing via SSMS on a client machine using Windows Authentication with no issues. Instructions say creating this external data source works for SQL Server 2016 and Azure Blob Storage.

我已经创建了主密钥:

CREATE MASTER KEY ENCRYPTION BY PASSWORD = <password>

,并且数据库范围凭证

CREATE DATABASE SCOPED CREDENTIAL UploadCountries WITH IDENTITY = 'SHARED ACCESS SIGNATURE', SECRET = <key>;

我已经通过查询sys.symmetric_keys和sys.database_scoped_credentials验证了这两种数据库中的存在.

I have verified both of these exist in the database by querying sys.symmetric_keys and sys.database_scoped_credentials.

但是,当我尝试执行以下代码时,它说'EXTERNAL'附近的语法不正确

However, when I try executing the following code it says 'Incorrect syntax near 'EXTERNAL'

CREATE EXTERNAL DATA SOURCE BlobCountries WITH ( TYPE = BLOB_STORAGE, LOCATION = '<somewhere>.table.core.windows/<somewhere>', CREDENTIAL = UploadCountries );

感谢您的想法和帮助!

史蒂夫.

推荐答案

在"在Azure Blob存储中批量访问数据的示例",我们可以找到:

In "Examples of Bulk Access to Data in Azure Blob Storage", we can find:

从SQL Server批量访问Azure blob存储至少需要SQL Server 2017 CTP 1.1.

Bulk access to Azure blob storage from SQL Server, requires at least SQL Server 2017 CTP 1.1.

并在"创建外部数据源(Transact-SQL)",我们可以找到类似的信息:

And in Arguments section of "CREATE EXTERNAL DATA SOURCE (Transact-SQL)", we can find similar information:

在SQL Server 2017中使用BULK INSERT或OPENROWSET执行批量操作时,请使用BLOB_STORAGE

Use BLOB_STORAGE when performing bulk operations using BULK INSERT or OPENROWSET with SQL Server 2017

您正在使用SQL Server 2016,因此在为Azure Blob存储创建外部数据源时出现Incorrect syntax near 'EXTERNAL'错误.

You are using SQL Server 2016, so you get Incorrect syntax near 'EXTERNAL' error when you create external data source for Azure Blob storage.

更多推荐

无法在SQL中创建外部数据源

本文发布于:2023-08-05 21:38:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1308205.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据源   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!