如何将excel上传到sql中的多个表中 [英] how to upload excel into multiple tables in sql

查看:107
本文介绍了如何将excel上传到sql中的多个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含10列的excel表。



i希望通过3个表将其导入到sql中。



table1

table2

table3



table1将有4列和来自table2的fkey和table3。

table2将有8列

table3将有8列。



如何使用数据库任务下的importdata?



请帮助。

谢谢

解决方案

< blockquote>表格是否保留在Excel中,并且您希望SQL从工作簿中读取?如果您已在management studio中创建了数据库,则可以将每个表保存为.csv文件并以此方式上载。如果你能澄清,我可以帮助你。



另外,你使用的是什么版本的SQL和Excel?


你可以在SQL Server中创建一个普通表并将Excel数据导入其中。



然后你可以执行SQL代码在表中创建规范化数据。



尝试 Excel的SaveToDB加载项 [ ^ ]。

它允许将数据从Excel保存到数据库表中。它是免费的。



如果您需要定期重复此任务,您可以使用存储过程自定义加载项中的保存数据。这是你需要的同样的任务。但这是企业版功能。


I have an excel sheet with 10 columns.

i want this to be imported into sql via 3 tables.

table1
table2
table3

table1 will have 4 columns and fkey from table2 and table3.
table2 will have 8 columns
table3 will have 8 columns.

how to accomplish this using the importdata under database tasks?.

Please help.
Thanks

解决方案

Are the tables staying in excel, and you want SQL to read from the workbook? If you have already created the database in management studio, you could save each table as a .csv file and upload that way. If you can clarify, I can help you.

Also, what version of SQL and Excel are you using?


You may create a plain table in SQL Server and import Excel data into it.

Then you may execute SQL code to create normalized data in your tables.

Try the SaveToDB add-in for Excel[^].
It allows saving data into database tables from Excel. It is free.

If you need to repeat this task periodically, you may customize saving data in add-in using stored procedures. It is the same task you need. But this is an Enterprise edition feature.


这篇关于如何将excel上传到sql中的多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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