This is a discussion on Data Insert Problems within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> [crossposted from sqlserver.msde] Greetings I am running a merge replication MSDE database with SP3 installed (on all computers). I ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| [crossposted from sqlserver.msde] Greetings I am running a merge replication MSDE database with SP3 installed (on all computers). I am having a problem inserting new records into certain tables at the subscriber database - not in all tables, only in specific ones. The error message I get is: ODBC--call failed. [Microsoft][ODBC SQL Server Driver][SQL Server] Violation of PRIMAY KEY constraint 'PK-XXXX'. Cannot insert duplicate key in object 'YYYYYY'.(#2627)[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. (#3621) I have checked, and my primary keys are defined identically between the tables that work to add records, and the tables that don't work. Furthermore, when accessing the distributor databse, I am able to add records to all tables without experiencing this error. It is on the subscriber only. Any guidance you can give would be greatly appreciated. Thanks! |
| ||||
| Sounds like there is already a record in the subscriber table that contains the same value for whichever field is defined as the Primary Key. It is possible that the reason it works with the distributor's database is because that field is not defined as the Primary Key. This is easily checked using SQL Enterprise Manager. Just call up the table properties and it will show which field is the Primary Key. It's also possible that this field is set as such even though it doesn't need to be. If you don't have read access to the SQL datbase, have yur distributor check the table properties for you. For the record, the Primary Key is used to uniquely identify each record in the table, thus duplicates are not allowed. Sometimes, the default setting is that the first field in the table is set as the Primary Key at database/table creation, even when a Primary Key is not required. You should be aware, however, that removing this tag from a field in a table can quickly lead to ambiguity within your database and all associated procedures and views. Make sure you investigate why it is marked as it is prior to changing it. -- Gregory Penoyer, Developer Division This posting is provided "AS IS" with no warranties, and confers no rights. Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated. |