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

Version 1

    Verified Product Versions

    LANDESK Management Suite 2016.xLANDESK Endpoint Manager 2017.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.    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)

       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)

       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)

       at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)

       at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

       at DPISoftware.DPI_Database.DPIDatabase.Execute_Param(String sSQL, String[] sCols, Object[] oVals)


    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 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 highlighted row is the one we need to edit to "varchar(max)"




    That row should be:


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


    After updating ac.xml, run the commands below in an admin 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.