简体   繁体   English

如何将多个访问数据库导入SQL Server

[英]How to import multiple access databases into SQL server

I have a folder called "Access" which contains 400 various access files. 我有一个名为“ Access”的文件夹,其中包含400个各种访问文件。 Each of these have the same structure, and 6 tables. 每个都有相同的结构和6个表。 I need to import these into Microsoft SQL Server (2014). 我需要将这些导入Microsoft SQL Server(2014)。 Due to a lack of detail in the Access databases, I also need to run a normalization script after each import to make sure the relationships in the tables are kept. 由于Access数据库中缺乏详细信息,因此我还需要在每次导入后运行规范化脚本,以确保保留表中的关系。

I've used the wizard, and it works fine, but if there's a way to automatically import all the files and save me a week of work manually importing it would be much appreciated. 我已经使用了该向导,并且运行良好,但是如果有一种方法可以自动导入所有文件,并为我节省了一周的手动导入工作,将不胜感激。

I've created SSIS packages to do this type of processing. 我已经创建了SSIS包来执行这种类型的处理。 Create a Foreach Loop Container, inside the container create a Data Flow Task that imports the files from the folder specified into your database/tables. 创建一个Foreach循环容器,在该容器内创建一个数据流任务,该任务将从指定的文件夹中的文件导入数据库/表中。 Then create a "file system task" that moves the file to a completed folder. 然后创建一个“文件系统任务”,将文件移动到完整的文件夹中。 This could then be scheduled via sql jobs to run until all the files are processed/imported. 然后可以通过sql作业将其计划为运行,直到处理/导入所有文件为止。

Google returned this: Google返回了以下内容:

    INSERT INTO [dbo].[#tblImport]
        Field1,Field2,Field3,Field4
    SELECT 
        [Field1],[Field2],[Field3],[Field4] 
    FROM OPENDATASOURCE_
    ('Microsoft.Jet.OLEDB.4.0','C:\My Database.mdb')...[TableName]

Source 资源

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

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