Search code examples
sql-serverdata-importsql-import-wizard

SQL Identity Insert is not creating Identity columns


I am importing data into a blank database and for some reason it is not creating identity columns.

I have selected "Enable identity insert"

enter image description here

But it is not creating the identity column. This is the original one:

enter image description here

id is an identity column, but in the imported table:

![enter image description here

Which hasn't created an identity column. Does anyone know why?


Solution

  • I figured this out. It right clicked the original database and clicked "Tasks > Generate Scripts" to a new query window. Then I used the Object Explorer (F7) on the target database and deleted all the tables. I made sure the scripts I created in the last step were targeting the new database and then I ran them.

    Once this was done, I was able to use the import wizard and check the "Enable identity insert".

    This worked.