Issue Description
If the Insert Into Data Source activity in CSPro is erroring with a message "String or binary data would be truncated", this means the SQL column is not large enough to fit the data you are trying to insert.
You will see the following error message in your CSPro Monitor:
System.Management.Automation.CmdletInvocationException: String or binary data would be truncated. The statement has been terminated. ---> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: String or binary data would be truncated. The statement has been terminated. Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at RepositoryLayer.Soap.IConnectorService.InvokeSourceUpsert(WebParam`1 connectorId, WebParam`1 parms) at Upsert.Cmdlet.Upsert.Run(ParameterListDTO parameters, Guid sourceId, String serviceUrl, String bindingConfig) at Upsert.Cmdlet.UpsertCmdlet.ProcessRecord() at System.Management.Automation.CommandProcessor.ProcessRecord() --- End of inner exception stack trace --- at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke) at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync) at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings) at WorkerX.Laborer.ExecutePowerShellWithFlags(WorkItem& workitem, String command, Boolean& hadErrorOutput, Boolean& hadTerminatingException, Object& outputFromRoutingExpression, Nullable`1 executionid, Boolean useLocalFunctions)
Resolution
Check which data you are trying to insert into the SQL table, and be sure each column is large enough to fit that field(s) value.
NOTE: For example, if you have a value containing over 50 characters being inserted into an nvarchar(50), this error will be present.
You can check what is saved in the metadata through the Monitor app:
- Select a batch from the Monitor
- Click View Batch
- Select a document to view it's metadata
You will need to expand the max allowed characters in your SQL columns to fit all data CSPro is attempting to insert.
Comments
0 comments
Please sign in to leave a comment.