Sunday, April 01, 2007

"Violation of PRIMARY KEY constraint 'ICUNIT_KEY_0'" when performing a DBload of data into MS-SQL

When importing data through DBLoad into a new Microsoft SQL database, the following error may  occur:


INSERT (error = 127, native code = 2627) message: [Microsoft][ODBC SQL Server Driver][SQL Server]Violation  of PRIMARY KEY constraint 'ICUNIT_KEY_0' Cannot insert duplicate key in object 'ICUNIT'


This  error is not evident performing the same procedure in an environment running another database engine such as Pervasive. This problem may be related to an incorrectly defined Sort Order or Collation Name in the setup of the Microsoft SQL database.


To correct this problem, do the following:

Set Sort order to Case Insensitive
Set collation name to Latin_general_bin

4 comments:

Anonymous said...

Thank you for your tips ,it helps me a lot.
Thank you

Sam said...

You mentioned that the error could be fixed by setting the sort order. "Set Sort order to Case Insensitive Set collation name to Latin_general_bin"

What else could be causing this issue?

My set collation name is set to Latin_general_bin.

Does the "Set Sort order to Case Insensitive" mean that it will still let the load occur even if the primary keys are set to the same name (for instance, test1 and TEST1) but are case sensitive? If so, how can I set the Sort order to Case Insensitive?

Thanks.

Anonymous said...

can you tell us please how can we set the Sort order to Case Insensitive?

Anonymous said...

Hello All, I am doing a database load from Pervasive SQL to Pervasive SQL and I am getting this error. Can you give me any assistance. I am at the client site right now 5/31/2009.
khenth6545@aol.com