将数据从Excel迁移到SQL Server

时间:2021-04-19 10:20:14

I have a lot of Excel and Access files. I need to create a new database and import these files into tables. How should I do this?

我有很多Excel和Access文件。我需要创建一个新数据库并将这些文件导入表中。我该怎么做?

1 个解决方案

#1


1  

If this is a one time job, do it manually:

如果这是一次性工作,请手动执行:

Copy the data from your source (right click or ctrl-c) table.

复制源(右键单击或ctrl-c)表中的数据。

In SSMS, right click the table and click "Edit Top 200 Rows". Select the space notated by a star (*) at the first empty row on the left.
Paste.

在SSMS中,右键单击该表,然后单击“编辑前200行”。在左侧第一个空行中选择由星号(*)标注的空格。糊。

Or you can use SSIS and automate by setting a For Each Loop Container, expression being the file name(s) in a particular folder. I am assuming all of your files have the same columns, so you can map the same columns from SOURCE to DESTINATION. This would be the quickest way, in my opinion.

或者您可以使用SSIS并通过设置For Each循环容器来自动化,表达式是特定文件夹中的文件名。我假设您的所有文件都具有相同的列,因此您可以将相同的列从SOURCE映射到DESTINATION。在我看来,这将是最快捷的方式。

http://help.pragmaticworks.com/dtsxchange/scr/FAQ%20-%20How%20to%20loop%20through%20files%20in%20a%20specified%20folder,%20load%20one%20by%20one%20and%20move%20to%20archive%20folder%20using%20SSIS.htm

#1


1  

If this is a one time job, do it manually:

如果这是一次性工作,请手动执行:

Copy the data from your source (right click or ctrl-c) table.

复制源(右键单击或ctrl-c)表中的数据。

In SSMS, right click the table and click "Edit Top 200 Rows". Select the space notated by a star (*) at the first empty row on the left.
Paste.

在SSMS中,右键单击该表,然后单击“编辑前200行”。在左侧第一个空行中选择由星号(*)标注的空格。糊。

Or you can use SSIS and automate by setting a For Each Loop Container, expression being the file name(s) in a particular folder. I am assuming all of your files have the same columns, so you can map the same columns from SOURCE to DESTINATION. This would be the quickest way, in my opinion.

或者您可以使用SSIS并通过设置For Each循环容器来自动化,表达式是特定文件夹中的文件名。我假设您的所有文件都具有相同的列,因此您可以将相同的列从SOURCE映射到DESTINATION。在我看来,这将是最快捷的方式。

http://help.pragmaticworks.com/dtsxchange/scr/FAQ%20-%20How%20to%20loop%20through%20files%20in%20a%20specified%20folder,%20load%20one%20by%20one%20and%20move%20to%20archive%20folder%20using%20SSIS.htm