将MS-Access数据库转换为SQL脚本的工具

时间:2022-09-27 13:20:43

Our Software Package uses MS-Access Database, this database has been modified many times, so, it's a bit complicated to just see the files (relationship between tables are small hell), anyway,

我们的软件包使用MS-Access数据库,这个数据库已经被修改了很多次,所以,仅仅看到文件就有点复杂(表之间的关系简直是地狱),

Is there a way or program to convert this mdb file to SQL Script (Any sort of SQL Script will do it for now).

是否有方法或程序将这个mdb文件转换为SQL脚本(目前任何类型的SQL脚本都可以)?

Thanks,

谢谢,

3 个解决方案

#1


3  

Have you looked at the SQL Server Migration for Microsoft Access?

您查看过Microsoft Access的SQL Server迁移吗?

If you convert a copy to SQL Server, you may be able to get a better feel for the database.

如果将副本转换为SQL Server,您可能会对数据库有更好的感觉。

#2


1  

SubSonic has options for dumping the database's design - as well as its' data - into SQL. I have found it incredibly handy in the past for backing up my test database to source code control.

SubSonic可以选择将数据库的设计和数据转储到SQL中。过去,我发现将测试数据库备份到源代码控制非常方便。

Download and install version 2.1 of SubSonic.

下载并安装亚音速版本2.1。

You can run the generation script entirely from the command line, but I personally find it easier to work with an App.Config file to be able to fiddle with the config options more easily. Setup a .Net project, and setup the App.Config file to the appropriate settings. Documentation on App.Config can be found here: http://subsonicproject.com/configuration/config-options/

您可以完全从命令行运行生成脚本,但是我个人认为使用App.Config文件更容易处理配置选项。设置. net项目,并将App.Config文件设置为适当的设置。关于App.Config的文档可以在这里找到:http://subsonicproject.com/configuration/config-options/

Here is a sample from an old project of mine:

这是我的一个老项目的一个例子:


<?xml version="1.0" encoding="utf-8" \>
<configuration>
    <configSections>
        <section name="SubSonicService" 
            type="SubSonic.SubSonicSection, SubSonic" 
            requirePermission="false"/>
    </configSections>

    <connectionStrings>
        <clear />
        <add name="subTest" 
            connectionString="Data Source=MYCOMP\MICROSOFTSMLBIZ\,56183;Database=someDB;User ID=someId;Password=somePasswrd!"
            providerName="System.Data.SqlClient" />
    </connectionStrings>

    <SubSonicService defaultProvider="subTest">
        <providers>
            <clear/>
            <add name="subTest" 
                type="SubSonic.sqlDataProvider, SubSonic" 
                connectionStringName="subTest"
                generatedNamespace="TerraCognita.Project.Services.DAL"
                includeTableList="^Bug$, ^Person$, ^Groups$, ^Project$, ^TimeInterval$"/>
        </providers>
    </SubSonicService>
</configuration>

Use a connection string appropriate for your DB, and (I believe) a provider appropriate for an Access database. (You can also specify most parameters at the command line, but I personally find it more straightforward to work with the config file.)

使用适合于数据库的连接字符串,以及(我相信)适合于访问数据库的提供者。(您也可以在命令行中指定大多数参数,但我个人认为使用配置文件更简单。)

Open a command prompt, the current folder should be the folder which has App.Config. The following is the command you need:

打开命令提示符,当前文件夹应该是具有App.Config的文件夹。以下是您需要的命令:

[Install Folder]\SubCommander\sonic.exe [Command] /out [OutputFileName]

安装文件夹\副指挥官\声波。exe(命令)/(OutputFileName)

Where [Command] can be scriptschema or scriptdata. (There are additional commands, but these are the two you will be interested in. Help is also an option.

Where [Command]可以是scriptschema或scriptdata。(还有其他命令,但这两个是您感兴趣的。帮助也是一种选择。

#3


1  

You can take a look at Database Comparer

您可以查看数据库比较器

#1


3  

Have you looked at the SQL Server Migration for Microsoft Access?

您查看过Microsoft Access的SQL Server迁移吗?

If you convert a copy to SQL Server, you may be able to get a better feel for the database.

如果将副本转换为SQL Server,您可能会对数据库有更好的感觉。

#2


1  

SubSonic has options for dumping the database's design - as well as its' data - into SQL. I have found it incredibly handy in the past for backing up my test database to source code control.

SubSonic可以选择将数据库的设计和数据转储到SQL中。过去,我发现将测试数据库备份到源代码控制非常方便。

Download and install version 2.1 of SubSonic.

下载并安装亚音速版本2.1。

You can run the generation script entirely from the command line, but I personally find it easier to work with an App.Config file to be able to fiddle with the config options more easily. Setup a .Net project, and setup the App.Config file to the appropriate settings. Documentation on App.Config can be found here: http://subsonicproject.com/configuration/config-options/

您可以完全从命令行运行生成脚本,但是我个人认为使用App.Config文件更容易处理配置选项。设置. net项目,并将App.Config文件设置为适当的设置。关于App.Config的文档可以在这里找到:http://subsonicproject.com/configuration/config-options/

Here is a sample from an old project of mine:

这是我的一个老项目的一个例子:


<?xml version="1.0" encoding="utf-8" \>
<configuration>
    <configSections>
        <section name="SubSonicService" 
            type="SubSonic.SubSonicSection, SubSonic" 
            requirePermission="false"/>
    </configSections>

    <connectionStrings>
        <clear />
        <add name="subTest" 
            connectionString="Data Source=MYCOMP\MICROSOFTSMLBIZ\,56183;Database=someDB;User ID=someId;Password=somePasswrd!"
            providerName="System.Data.SqlClient" />
    </connectionStrings>

    <SubSonicService defaultProvider="subTest">
        <providers>
            <clear/>
            <add name="subTest" 
                type="SubSonic.sqlDataProvider, SubSonic" 
                connectionStringName="subTest"
                generatedNamespace="TerraCognita.Project.Services.DAL"
                includeTableList="^Bug$, ^Person$, ^Groups$, ^Project$, ^TimeInterval$"/>
        </providers>
    </SubSonicService>
</configuration>

Use a connection string appropriate for your DB, and (I believe) a provider appropriate for an Access database. (You can also specify most parameters at the command line, but I personally find it more straightforward to work with the config file.)

使用适合于数据库的连接字符串,以及(我相信)适合于访问数据库的提供者。(您也可以在命令行中指定大多数参数,但我个人认为使用配置文件更简单。)

Open a command prompt, the current folder should be the folder which has App.Config. The following is the command you need:

打开命令提示符,当前文件夹应该是具有App.Config的文件夹。以下是您需要的命令:

[Install Folder]\SubCommander\sonic.exe [Command] /out [OutputFileName]

安装文件夹\副指挥官\声波。exe(命令)/(OutputFileName)

Where [Command] can be scriptschema or scriptdata. (There are additional commands, but these are the two you will be interested in. Help is also an option.

Where [Command]可以是scriptschema或scriptdata。(还有其他命令,但这两个是您感兴趣的。帮助也是一种选择。

#3


1  

You can take a look at Database Comparer

您可以查看数据库比较器