Re: error: when insert into table

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 09/10/04

  • Next message: Vishal Parkar: "Re: Exclusive Query"
    Date: Sat, 11 Sep 2004 03:10:06 +0530
    
    

    The error that you are getting is related to the violation of "PRIMARY KEY"
    constraint. To know what primary key is defined on the table run the
    following statment.

    sp_pkeys <table name>

    Make sure that you are inserting non duplicate values in the primary key.

    ex:

    create table t(idd int primary key)

    insert into t values (1)
    insert into t values (2)
    insert into t values (3)
    insert into t values (3) --error

    in above case 4th insert into will fail because of duplication of primary
    key value.

    -- 
    Vishal Parkar
    vgparkar@yahoo.co.in | vgparkar@hotmail.com
    

  • Next message: Vishal Parkar: "Re: Exclusive Query"

    Relevant Pages

    • Re: Allen Brownes function: "Duplicate record (and related child record)" -- my modified ver
      ... Duplicate the main form record and related records in the subform. ... Dim strSQL As String ... Dim lngOldID As Long '*** Primary key value of the orginial record. ... - "TrackingNumber" is primary key ...
      (microsoft.public.access.formscoding)
    • Re: Allen Brownes Copying forms/Subforms
      ... Is OrderID the primary key? ... Allen Browne - Microsoft MVP. ... perhaps the duplicate is on another field where you specified a "No ...
      (microsoft.public.access.modulesdaovba)
    • RE: Duplicate record with child fields
      ... with the sub table tblWesternBlotWorksheetsub ... record and trying to put it in the primary key of the new record. ... to copy duplicate records with child fields. ... GelNumber is the primary Key in the main table with a 1:N relationship ...
      (microsoft.public.access.forms)
    • Re: Duplicate the record in form and subform
      ... Have changed the code as below but got an error message "Error#3061, ... Dim strSql As String 'SQL statement. ... Dim lngID As String 'Primary key value of the new record. ... 'Make sure there is a record to duplicate. ...
      (microsoft.public.access.formscoding)
    • replication fail
      ... When doing a search for "Violation of Primary Key ... >Violation of primary key constraint 'PK-measure'. ...
      (microsoft.public.sqlserver.replication)