Archive/Copy to Asset Control Fails, "Could not insert data"

Version 3

    Verified Product Versions

    Endpoint Manager 2016.xEndpoint Manager 2017.xEndpoint Manager 2018.x



    Archiving or copying an asset to Asset Control fails with an error similar to the one below:

    INFORMATION 10/5/2017 9:02:24 AM: Could not insert data SQL = INSERT INTO MP_AC_Battery(MP_AC_Devices_Idn, Line, BackupLife, BackupSeconds, BackupStatus, Condition, ChargePercent, Charge, Chemistry, Currentma, CycleCnt, Description, DeviceID, DeviceName, Life, Manufacturer, Percentavail, Seconds, SerialNum, Batterystate, Temperature, Batterytype, Voltage ) VALUES (1010,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?,  ?) Error =  String or binary data would be truncated.

    The statement has been terminated.


    The asset does move over, but is missing information.




    This is caused by an Asset Control database table having a column with a size that is too small to handle the incoming data. This is essentially the same issue as this one, but for Asset Control.




    To fix this, identify the affected table, found in the "INSERT INTO xxxxx" section of the error. The example above affects MP_AC_Battery.


    Next, edit the ac.xml file under %ldms_home% on the core and edit the affected columns for that table to be varchar(max). The known affected columns are below, organized by table.


    Table - Column


    MP_AC_Battery - BatteryType


    MP_AC_Printer - Version


    MP_AC_EnvironSettings - Name

    MP_AC_EnvironSettings - ValueString


    MP_AC_Video - DriverName


    Below is an example for the error above, regarding MP_AC_Battery. The problematic entry is on row 15.


    <table name="MP_AC_Battery" desc="" metaAdd="Yes" equiJoin="No" displayName="Battery" parentRelation="Device" parent="MP_AC_Devices" tableType="1" image="battery.bmp" rollupIdentity="Yes" >
    <column name="MP_AC_Devices_Idn" type="Int" null="No" />
    <column name="Battery_Idn" type="Int" identity="Yes" null="No" />
    <column name="Line" type="Varchar(30)" displayName="AC Line Status" />
    <column name="Charge" type="Varchar(30)" displayName="Charge Status" />
    <column name="BackupStatus" type="Varchar(30)" displayName="Backup Status" />
    <column name="Chemistry" type="Varchar(30)" displayName="Chemistry" />
    <column name="Seconds" type="Varchar(30)" displayName="Seconds Remaining" />
    <column name="BackupSeconds" type="Varchar(30)" displayName="Backup Seconds Remaining" />
    <column name="Voltage" type="Int" displayName="Voltage (mV)" />
    <column name="Currentma" type="Int" displayName="Current (mA)" />
    <column name="Life" type="Int" displayName="Life Percent" />
    <column name="BackupLife" type="Int" displayName="Backup Life Percent" />
    <column name="Temperature" type="Varchar(10)" displayName="Temperature (Celsius)" />
    <column name="Batterytype" type="Varchar(max)" displayName="Type" />
    <column name="Percentavail" type="Varchar(30)" displayName="Percent Available" />
    <column name="Batterystate" type="Varchar(30)" displayName="State" />
    <primaryKey name="XPKMP_AC_Battery">
    <primaryKeyColumn column="MP_AC_Devices_Idn" />
    <index name="XIF_MP_AC_BatteryId">
    <indexColumn column="Battery_Idn" />


    That row should be:


    <column name="Batterytype" type="Varchar(MAX)" displayName="Type" />


    After updating ac.xml, run the commands below in an elevated command prompt on the Core:


    cd %LDMS_HOME%

    CoreDBUtil.exe /xml="ac.xml"


    Then run "Build Components" in the launched CoreDBUtil window.




    After that finishes, restart the "Managed Planet Core Scan Processor" service.