如何将xls导入Azure数据库? [英] How to import xls into Azure Database?

查看:59
本文介绍了如何将xls导入Azure数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的数据库需要填写我们国家/地区中每个州的邮政编码,我们在xls文件中提供了邮政编码目录,我们必须将此文件导入Windows Azure中托管的数据库中的表中

Our database needs to be filled with the zip code for every state in our country, we are provided with a catalog of zip codes in a xls file, we have to import this file to a table in a database hosted in Windows Azure.

我不知道Stack Overflow是否允许我发布指向我们xls的链接,但是我将描述文件的结构:

I don't know if Stack Overflow allows me to post a link to our xls, but I'll describe the structure of the file:

每张纸都保存着整个州的邮政编码信息,在每张纸中,我们有15列,其中包含诸如邮政编码,地形类型,区域类型,位置,州,城市等信息.每张纸都具有相同的信息列和单元格内的信息可能包含西班牙语常用的特殊字符(即á,é,ó,ú等),并且需要保留这些特殊字符.另外,某些单元格可能是空的,也可能是空白,并且单元格的内容中可能会出现空白(例如Villa de Montenegro).

Every sheet holds the zip code information for a whole state, inside every sheet we have fifteen columns with information such as zip code, type of terrain, type of area, locality, state, city, etc. Every sheet has the same columns and the information inside the cells may contain special characters (i.e. á, é, ó, ú, etc.) normal to Spanish language and this special characters need to be preserved. Also some cell may be empty or not and blank spaces are likely to appear in the contents of the cells (i.e. Villa de Montenegro).

我们正在寻找一种方法,可以将每张工作表导入到表格中,而不会丢失特殊字符或跳过空白单元格.我们没有执行此类任务的经验,因此想知道导入它的最佳方法是什么.

We are looking for a way to import every sheet into our table without losing special characters or skipping empty cells. We have no prior experience doing this kind of task and wanted to know what is the best way to import it.

我们尝试了将xls导入CSV文件,然后将那些CSV导入我们的数据库的建议,但是我们尝试了此处推荐的宏的一些变体,但是CSV生成时有很多错误(宏不是我们的专长).

We tried a suggestion of importing the xls to CSV files and then importing those CSV to our database, but we tried some of the variations of the macro recommended here but the CSV are generated with many errors (Macros aren't our forte).

简而言之,将xls导入到Azure数据库表中而不丢失空单元格,特殊字符或当单元格中的空格失败时的最佳方法是什么?

In short, what is the best way to import our xls to an Azure database table without losing empty cells, special characters nor failing when blank spaces are inside a cell?

推荐答案

我们发现了一种简单但缓慢的方法,可以使用Visual Studio从xls复制内容,我们使用的版本是2012,但可与2008和2013一起使用也是.

We found an easy, although slow, way to copy the contents from an xls using Visual Studio, the version we used was 2012 but it works with 2008 and 2013 too.

  1. 打开服务器资源管理器.
  2. 添加新连接,数据库的URL是必需的,凭据与您用于在Azure上访问数据库的凭据相同.如果需要,请测试连接,如果凭据正确,那么一切就很好了.
  3. 建立连接后,展开表"部分,然后选择要转储数据的表.
  4. 右键单击并选择查看表数据.
  5. 如果表为空或已经有一些数据,则工作流程相同.最后一条记录将为空,将其选中.
  6. 转到xls文件,要使其正常工作,列的数量和顺序必须与要转储数据的表相同.选择所需的行,将其复制.
  7. 返回Visual Studio,同时选择最后一个空行以粘贴数据.数据将开始直接直接复制到您的Azure数据库中.
  8. 取决于您的互联网连接和要处理的数据量,这可能需要很长时间.

这是一个简单的解决方案,尽管不是最佳方案.如果您不拥有SQL Server的所有工具,则此方法有效.仍然需要检查这是否适用于速成版,在我测试时会更新.

This is an easy solution, although not optimal. This works if you don't own SQL Server with all of its tools. Still gotta check if this works on the express edition, will update when I test.

这篇关于如何将xls导入Azure数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆