I am getting the following message on an Insert query to an MS database:

  The changes you requested to the table were not successful because they
would create duplicate values in the index, primary key, or relationship.
Change the data in the field or fields that contain duplicate data, remove the
index, or redefine the index to permit duplicate entries and try again

I have two fields that must be unique and the values being inserted do not yet
exist in the database.  I've checked all of the indexes and only one
relationship exists to this database and that is a 1 to 0-Many.

I've also reindexed the database.

What else could be going on????

Here is the insert statement:

<cfquery name="qryOrder" datasource="#instance.Settings.DSN#" dbtype="ODBC"
UserName="#instance.Settings.DBWrite.ID#"
        password="#instance.Settings.DBWrite.PW#">

        Insert into tabOrders
            (OrderNumber, Customers_FK, PeachtreeOrderNumber, OrderDate,
IsOrderClosed,
             ShipToAddressKey, ShipToName, ShipToAddr1, ShipToAddr2,
ShipToCity, ShipToState,ShipToZip, ShipToCountry,
             PO, RequestedShipDate, ShippingMethod, Terms, SalesTax,
ShippingChrg, Comment, EnteredBy_FK, ChangedOn)

     Values (
            <cfqueryparam value="#instance.OrderNumber#"
cfsqltype="cf_sql_numeric">,
             <cfqueryparam value="#instance.CustomerKey#"
cfsqltype="cf_sql_numeric">,
             <cfqueryparam value="#instance.PeachtreeOrderNumber#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.OrderDate#"
cfsqltype="CF_SQL_DATE">,
             <cfqueryparam value="#instance.IsOrderToBeClosed#"
cfsqltype="CF_SQL_BIT">,

             <cfqueryparam value="#instance.ShipToAddressKey#"
cfsqltype="cf_sql_numeric">,
             <cfqueryparam value="#instance.ShipTo.Name#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.ShipTo.Addr1#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.ShipTo.Addr2#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.ShipTo.City#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.ShipTo.State#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.ShipTo.PostalCode#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.ShipTo.Country#"
cfsqltype="cf_sql_char">,

             <cfqueryparam value="#instance.PONumber#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.RequestedShipDate#"
cfsqltype="CF_SQL_DATE">,
             <cfqueryparam value="#instance.ShippingMethod#"
cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.Terms#" cfsqltype="cf_sql_char">,
             <cfqueryparam value="#instance.SalesTax#"
cfsqltype="CF_SQL_MONEY">,
             <cfqueryparam value="#instance.ShippingCharge#"
cfsqltype="CF_SQL_MONEY">,
             <cfqueryparam value="#instance.OrderComment#"
cfsqltype="CF_SQL_VARCHAR">,

             <cfqueryparam value="#instance.UserKey#"
cfsqltype="cf_sql_numeric">,
             <cfqueryparam value="#arguments.DateChanged#"
cfsqltype="CF_SQL_TIMESTAMP">);
       </cfquery>

Any and all thoughts are much appreciated.

Andy

Andy Ousterhout
O'My Goodness
www.omygoodness.com
910 Sherwood Drive, Unit 19
Lake Bluff, IL    60044

Phone 847.735.9890
Fax     847.735.9910
Yahoo IM:  andy_ousterhout
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to