Migrating Access 2013 Autonumber fields to SQL Server tables.

A client is outgrowing the Access 2013 (32bit) DB size restriction so I want to migrate to a SQL Server backend.

There are many, many table to be converted.  I have tried pulling the tables to a SQl Db using SQL Server Migration  Assistant for Access (32bit).  Generally the table pulls correctly converting the Access data types to SQL data types and retaining the data.

However, I am having an issue with the autonumber fields.

As background, in every table I define the first field is ‘ID’.  They type is set to autonumber and I also set it as the primary key for the table.
When the tables are pulled into SQL the ID filed is converted to type ‘int’.  

The primary key specification is kept.
I noticed this when I tried to add new record to the table and got a duplicate error.

In SQL design mode, I tried changing the type of the SQL ‘ID’ field to ‘uniqueidentifier’ but I get an error, ‘Conversion From ‘int’ to ‘uniqueidentifier’ is not supported on the connected database server.

When I look in the script to create the table the first lines are
CREATE TABLE [dbo].[tblProperty](
      [ID] [int] IDENTITY(1,1) NOT NULL,
      [Muni] [nvarchar](3) NULL,

I thought maybe the issue was that there was already data in the table so I tried everything again for another table that I had removed the result of.  Same issue.

I looked in the mapping options in SSMA from Access field type to SQL field type and there is no option to convert an autonumber field.

Question:  How are you migrating your Access 2013 tables to SQL so the autonumber fields are converted properly?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PortletPaulEE Topic AdvisorCommented:

that is an "autonumber" in SQL Server

IDENTITY [ (seed , increment) ]
Identity columns can be used for generating key values. The identity property on a column guarantees the following:
    Each new value is generated based on the current seed & increment.
    Each new value for a particular transaction is different from other concurrent transactions on the table.
see: IDENTITY property

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SSMA has a Keep identity setting

It specifies whether SSMA preserves Access identity (aka AutoNumber) values when it adds data to SQL Server. If this value is False, SQL Server assigns identity values.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Access AutoNumber would not be equal to  the SQL UniqueIdentifier datatype. That's a GUID:


The equivalant would be the Identity type, as Paul Maxwell has indicated.

If you're using the Migration Assistant, it should have converted those to the Identity type (assuming you didn't change it, of course). You can check your tables after they're created in SQL to insure they are set as Identity - open the table in Design view, and check the Identity property of your ID column - it should read YES.
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

mlcktmguyAuthor Commented:
Thanks for the clarification and additional information.
I'm not sure what started this practice but naming every primary key "ID" simply obfuscates relationships.  If you name primary keys after their table, they are easy to spot when used as foreign keys and even someone unfamiliar with the relationships can get a sense of how tables are related.
Armen Stein - Microsoft Access MVP since 2006President, J Street TechnologyCommented:
I agree, Pat.

For primary keys, we use a naming convention like:


When primary keys appear as foreign keys, we use the exact same names.  However, we make exceptions to disambiguate, for example:


Armen Stein, Access MVP
J Street Technology
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.