Am working on syncing my internal products database with nopCommerce, therefore most products already exist in internal db, and I would like to upload them to a SQL Server nop-database.
I want to re-use all PK’s that are in internal DB since it would make it easy for me to match them and automate the sync. It does not allow me to manually add the PK, since the PK is set to autoincrease in the DBMS.
How can i change it so I could add my own PK numbers, but I also want the DB to continue behaving properly if I use the admin CP and add products manually?
To allow primary keys to be set when the column is an identity you need to set identity insert on. Format is
You probably want the identity seed for the DB you are moving these to to be well above any of the primary keys you will be setting manually so you don’t have a conflict
When you are finished set it back
http://msdn.microsoft.com/en-us/library/ms188059.aspx