Error: "Failed to copy records from Contact2 to GoldMineTempCopy Table"

Version 1

    Details

    Error: "Failed to copy records from Contact2 to GoldMineTempCopy Table"


     


    Resolution

     

    [CAUSE]

    General cause for this error is due to a Mismatch between the fields on the Contact2 and Contudef tables in regards to user-defined fields. 

    Examples include but are not limited to:
    a. A field may exist on one table but on the other due to a failed rebuild of the database
    b. The length of a field on one table does not match the length on the other table
    c. The field description/type from one table does not match the description/type on the other table

    [RESOLUTION]

    Step 1: Contact2 vs Conudef Field Counts:

    Query Number of user-defined fields in ContUdef:

    NOTE: Queries can be run directly in GoldMine or in SQL Management Studio. (For the purpose of this article we will be using the GoldMine user Interface)

    1. Tools > SQL Query
    2. Copy and Paste the following query into the query box: Select count (*) from contudef where dbfname= 'contact2' and field_name > 'u'
    3. Click the Query button on the right
    4. Note the number of returned results [2nd column]

    (This are the fields you see in GoldMine under File > Configure > Custom Fields.)


    Query Number of user-defined fields in Contact2:

    1. Tools > SQL Query
    2. Copy and Paste the following query into the query box: Select count (*) name from syscolumns where id =(select id from sysobjects where name= 'contact2')and name > 'u'
    3. Click the Query button on the right
    4. Note the number of returned results [2nd column]

    (This is the number of user-defined fields that actually exist and can store data.)




    [RESULTS]

    IF Contudef and Contact2 Counts Match Continue to Step 2 below

    Contudef and Contact2 Do NOT Match - The fields that are missing/extra on one table should either be added or deleted through the back end of the database in SQL Management Studio. Unfortunately GoldMine support cannot assist with this process. It is advised that you seek a GoldMine Solutions Partner or SQL Admin to perform this action. 

    Step 2: Comparing properties of user-defined fields from Contact2 & Contudef for inconsistencies:

    NOTE: Mismatches can include the field Name, Type, and Length of data the field can hold. 

    To determine Name, Type, and Length of user-defined fields defined in contudef: 

    1. In GoldMine, select Tools > Configure > Custom Fields
    2. Right click in the list of user-defined fields
    3. Choose to output to > Excel  (Note: If Excel is not available, can Output to Clipboard and paste into Notepad.) 
     



    To determine the properties of user-defined fields added to the contact2 table:
     
    1. In GoldMine, select Tools > SQL Query 
    2. Copy and Paste the following query into the query box: SELECT Column_Name as Name, Data_type as Type, CHARACTER_MAXIMUM_LENGTH as Len FROM INFORMATION_SCHEMA.COLUMNS where table_name = 'contact2' and column_name like 'U%'
    3. Click the Query button on the right
    4. Right click on the results
    5. Choose to output to > Excel (Note: If Excel is not available, can Output to Clipboard and paste into Notepad.) 


    NOTE: Exporting these lists to excel will give you two sets of lists that can be easily compared of inconsistencies in field names, field type, and field length.   





    COMPARING DATA:

    WARNING: The Field Names, Type and Length must match each other on both lists! 

    NOTE: The mismatched fields should be fixed through the back end of the database in SQL Management Studio. Unfortunately GoldMine support cannot assist with this process. It is advised that you seek a GoldMine Solutions Partner or SQL Admin to perform this action. 


    The following values are considered matches for Type: 
    C = varchar
    D = datetime
    N = float, int, smallint, etc. (SQL numeric types)

     
    Date fields will have a length of 8 defined in the contudef table – the contact2 query will have a blank length for datetime fields.  This should be considered a “match”.