Problems with Identity / AutoNumber columns after migrating Access databases to MSSQL
Migrating from Access to MSSQL can be tricky, one issue in particular often arises if you import using the Microsoft SQL Management Studio import wizard.
After importing, many users find that they start receiving "[id] column cannot be Null" errors after they start using their new SQL database. This is mainly because the "id" column lost some of it's properties during the import from Access to SQL. Unfortunately, the SQL Management Studio import wizard does not automatically migrate all of the Access AutoNumber column's properties. Several steps have to be taken when importing to ensure that the new database is created correctly, and that the autonumber columns are properly transformed into what's known as SQL Identity columns (SQL Server's equivalent to the Access AutoNumber).
In the MS SQL Management Studio, at time of initial import, when the database is still blank, when you get to the step where you select the tables to import, for each table you must click "Edit Mappings" and do the following.
1. Check the "Enable Identity Insert" option.
2. Click "Edit SQL".
3. Modify the line "[id] int NOT NULL," and change it to read "[id] int IDENTITY(1,1),".
Repeat this step for each table.
Once you have done that for each table, you can continue the Import. The steps above should ensure that all of your Access columns are properly imported. If you need assistance, we recommend that you contact Technical Support for help.
After importing, many users find that they start receiving "[id] column cannot be Null" errors after they start using their new SQL database. This is mainly because the "id" column lost some of it's properties during the import from Access to SQL. Unfortunately, the SQL Management Studio import wizard does not automatically migrate all of the Access AutoNumber column's properties. Several steps have to be taken when importing to ensure that the new database is created correctly, and that the autonumber columns are properly transformed into what's known as SQL Identity columns (SQL Server's equivalent to the Access AutoNumber).
In the MS SQL Management Studio, at time of initial import, when the database is still blank, when you get to the step where you select the tables to import, for each table you must click "Edit Mappings" and do the following.
1. Check the "Enable Identity Insert" option.
2. Click "Edit SQL".
3. Modify the line "[id] int NOT NULL," and change it to read "[id] int IDENTITY(1,1),".
Repeat this step for each table.
Once you have done that for each table, you can continue the Import. The steps above should ensure that all of your Access columns are properly imported. If you need assistance, we recommend that you contact Technical Support for help.
Related Articles
Related Topics
Search for help...