简体   繁体   English

Azure SQL Blob存储选择

[英]Azure SQL blob storage select

I am attempting to create a temp table to store the values of an xlsx file on my azure blob storage, I have followed numerous Microsoft articles now and I am under the impression that I should be using SELECT * FROM OPENROWSET() , this seems to be working or at least selecting something. 我试图创建一个临时表以将xlsx文件的值存储在我的azure blob存储中,现在我关注了许多Microsoft文章,给我的印象是我应该使用SELECT * FROM OPENROWSET() ,这似乎工作或至少选择一些东西。

Here is my code: 这是我的代码:

SELECT * INTO ##TempTest FROM OPENROWSET(BULK  'test.xlsx',
   DATA_SOURCE = 'DevStoreAccount', SINGLE_CLOB) AS a;

SELECT * FROM ##TempTest

This all runs fine, but the output is not what I am expecting , surely this should return all my columns / rows from the excel file? 一切运行正常,但是输出不是我所期望的 ,当然这应该返回excel文件中的所有列/行吗? Or am I mistaken? 还是我弄错了?

The above code returns the following: 上面的代码返回以下内容:

在此处输入图片说明

What exactly is it returning and should I be doing something different? 它到底返回了什么,我应该做些不同的事情吗? Any help would really be appreciated. 任何帮助将不胜感激。

I'm trying this route as the columns in the excel file could change at any time, so I need to dynamically create my tables. 我正在尝试此路线,因为excel文件中的列可能随时更改,因此我需要动态创建表。

I'd recommend checking this thread , although the post is old, it is still relevant to your question. 我建议检查此线程 ,尽管该帖子很旧,但仍然与您的问题有关。 The approach taken for the similar scenario: 在类似情况下采取的方法:

1- Create and update Excel file using Open XML SDK 1-使用Open XML SDK创建和更新Excel文件

2- Upload Excel Template in Azure BLOB 2-在Azure BLOB中上传Excel模板

3- Download Excel template in azure web role local storage 3-在Azure Web角色本地存储中下载Excel模板

4- Read and update excel file from azure web role local storage 4-从Azure Web角色本地存储读取和更新Excel文件

5- Upload updated excel in Azure BLOB. 5-在Azure BLOB中上传更新的Excel。

II You could also use another similar concept as mentioned here II您还可以使用此处提到的另一个类似概念

  1. Downloading excel file as Stream from BLOB 从BLOB将Excel文件下载为流

  2. Creating Excel document using Open XML SDK 使用Open XML SDK创建Excel文档

  3. After edit saving doc to Stream 编辑后将文档保存到流

  4. Uploading back the Stream to BLOB 将流上传回BLOB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM