3

Export. We are doing the export Ms access to SQL Server.

We know how to export that table by table. What we are facing and no way to handle is that the relations which existed in MS Access between the table will lost after exporting. That is pretty annoying. Is there a way or tool that can allow us to deal with several tables one time or is there some workaround?

1
  • You wish to maintain the relations between the tables during transfer? Commented May 14, 2012 at 3:39

4 Answers 4

2

Since you tagged this with c#, I'm going to assume that you want to implement this yourself. Here are the building blocks that you need for this:

  1. Create a DAO connection to your Access database (add a reference to the DAO library, create a new DBEngine and then use its OpenDatabase method to get a Database reference):

    DBEngine dbe = new DBEngine();
    Database db = dbe.OpenDatabase(pathToDatabase);
    
  2. Iterate through the Relations property to access the relations stored in the MS Access database.

  3. Create the relations in your SQL Server database. To do this, you can either

    • use SMO or
    • plain old T-SQL:

      ALTER TABLE table1 
      ADD CONSTRAINT table1_fkfield_fk FOREIGN KEY (fkfield) 
      REFERENCES table2 (pkfield)
      
Sign up to request clarification or add additional context in comments.

2 Comments

Can you show me some examples or link which you developed this?
@KarthicG: Sorry, I didn't implement it, I just thought it through.
1

Looks like Microsoft has an answer for this. There is an option in Access called Upsizing Wizard, which "Preserves database structure, including data, indexes, and default settings."

Here is the link to the KB article explaining more: http://support.microsoft.com/kb/237980

1 Comment

Thank you while there seems no mention of relations.
1

Use SQL Server Data Transformation Services (DTS) to import the data from your Access database to a SQL Server database. For more information about DTS and the DTS Import Wizard, see the "Data Transformation Services" and "Using the Import and Export Wizards" topics in SQL Server 7.0 Books Online. For an example, see the "Importing Data from an Access Database Example" topic in SQL Server Books Online.

Comments

0

For migrating the Access Database to SQL Server we have many third party tools and Microsoft Assitant also there .Check this links Link 1 Link 2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.