简体   繁体   中英

Migrating MS Access Database to SQL Server 2008 R2

I have a SQL Server 2008 R2, I want to migrate data from MS Access, but when I tried to use SSMA the option of choosing SQL Server 2008 R2 is not available.

Any help please and is SSIS useful in my situation?

Well, it really comes down to how many tables and how many relationships you have in the access database.

You could for example install free edition of sql server express on your work station, and do the migration local (say to sql 2017 format).

At that point, then you can choose to script out the database - and later versions of SSMS (sql management studio) certainly supports 2008. Eg this:

在此处输入图像描述

So, don't right click on database and choose "Script database as", but choose from the task menu "Generate scripts".

From that, we see that 2008 still can be scripted to.

在此处输入图像描述

While of course even in the latest version of sql server, you CAN create a older version database. However, when you create a "previous" version of a database (say in the latest edition of sql server, that only limits compatibility features, but DOES NOT permit you to use or make a back up file made to be restored in previous versions of sql server. (sql server kind of nasty that way - you can ONLY go forward with databases - great capability, but once you move, you can't use nor create backup files that can be consumed by previous versions. But you CAN script out to previous versions.

And part of this comes down to how much time you spent using SSMAA.

And if you do go down the above road, then make sure you tweak the column mappings. So for example, by default datetime in access gets converted to datetime2, and I don't quite remember if 2008 supports datetime2. (regardless, I would stick to datetime anyway).

So, even using the latest migration assistant, you can set (tweak) the column mappaings, and it so at most, you need 1 or 2 changes (such as defaulting to datetime in place datetime2 column types).

And getting and setting up sql express local is a great way to test the migration over and over, since often the first few goes might fail, or not produce the resutls you want. This in fact is another HUGE reason to adopt SSMAA, since you can spend a date tweaking and changing some things, and run it again, and even again.

Now, if you script out a whole database (and data), such text files are RATHER large, and in most cases, you can't use the SSMS (sql management studio) to load such a script, so use the command line sqlcmd.exe to import (process) that scripted database you create by using the scripting wizard I outline above. It spits out a "big" text file, and that can be imported into 2008.

I mean, even with 2008 and that era of SSMS, it does have a import option, and you can import from access databases. However, when you do this, the PK's are dropped, indexes are dropped, and so are relatonships dropped.

So, for 2-5 tables - gee, just import using ssms.

However, if you have 40 tables, boatloads of relationships? Then yes, that is a big job, and I would then 100% recommend you use the Access migration assistant tool. (it takes a bit of time to learn - bit confusing at first, but once you pass the learning curve, I high recommend this tool if you wanting to move up many tables, keep the PK settings, and of course keep related data intact.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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