web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SQLException due to too long value. But MaxLength not exceeded

(0) ShareShare
ReportReport
Posted on by 10
Hey,

While creating a lead, I get a weird Exception.
As soon as the subject field exceeds 51 chars a SQLException is thrown. But in CRM the maximum length of this field is set to 300 chars.

Has anyone an idea?

System: CRM-Online
Early/latebound: Earlybound


{Exception details: ErrorCode: 0x80073001 Message: Sql error: A validation error occurred. A string value provided is too long. CRM ErrorCode: -2147012607 Sql ErrorCode: -2146232060 Sql Number: 8152 TimeStamp: 2019-06-17T09:54:28.1568230Z -- Exception details: ErrorCode: 0x80073001 Message: Sql error: A validation error occurred. A string value provided is too long. CRM ErrorCode: -2147012607 Sql ErrorCode: -2146232060 Sql Number: 8152 TimeStamp: 2019-06-17T09:54:28.1568230Z -- Exception details: ErrorCode: 0x80073001 Message: Sql error: A validation error occurred. A string value provided is too long. CRM ErrorCode: -2147012607 Sql ErrorCode: -2146232060 Sql Number: 8152 TimeStamp: 2019-06-17T09:54:28.1568230Z -- Exception details: ErrorCode: 0x80040216 Message: Exception output:: System.Data.SqlClient.SqlException (0x80131904): 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, Boolean shouldCacheForAlwaysEncrypted) 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 Microsoft.Crm.CrmDbConnection.LockConnectionAndExecuteMethod[TResult](IDbConnection connection, Func`1 executeMethod) at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, ICrmTransaction crmTransaction) at Microsoft.Crm.CrmDbConnection.<>c__DisplayClass122_0.<InternalExecuteNonQuery>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.Platform.Server.DataEngine.SqlDataAccessManager.ExecuteNonQuery(IDbCommand command, ISqlExecutionContext context, Int32 sourceLineNumber, String memberName, String sourceFilePath) at Microsoft.Crm.Platform.Server.DataEngine.EntityCrudManager.Create(IBusinessEntity entity, ExecutionContext context) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoCreate(IBusinessEntity entity, ExecutionContext context) ClientConnectionId:419f89ff-ca05-4488-82f1-b3fd286dbb7c Error Number:8152,State:13,Class:16 ClientConnectionId before routing:dc443f59-ff1a-44ed-b79c-078a9fce65bf Routing Destination:e6c362a837bc.tr641.northeurope1-a.worker.database.windows.net,11042 Error(s) details: Class: 0x10 LineNumber: 1 Message: String or binary data would be truncated. Number: 8152 Procedure: Server: e6c362a837bc.tr641.northeurope1-a.worker.database.windows.net,11042 Source: .Net SqlClient Data Provider State: 13 ToString(): System.Data.SqlClient.SqlError: String or binary data would be truncated. -- Class: 0x0 LineNumber: 1 Message: The statement has been terminated. Number: 3621 Procedure: Server: e6c362a837bc.tr641.northeurope1-a.worker.database.windows.net,11042 Source: .Net SqlClient Data Provider State: 0 ToString(): System.Data.SqlClient.SqlError: The statement has been terminated. -- : Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #F01E7DEE TimeStamp: 2019-06-17T09:54:28.1568230Z -- }


*This post is locked for comments

I have the same question (0)
  • Verified answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    The 50 chars limit is for names fields like First Name, Last Name, and Middle Name. Make sure you are not setting longer values to these fields.

    The error message does not have the details on which field exceeded the limit.

    I would enable plugin trace log in CRM and see if you could find more error details around to see which field the error is referring to.

    If the plugin trace log does not have any meaningful message, I would check if there are any processes in CRM plugin / real-time workflow that copies lead the subject into any other field that has a max limit set to 50 chars.

    In your client side code, try setting value only to subject field and leave all other blank and try to create and see if it fails to rule out it's not caused by you setting the longer value to other fields.

  • andzie Profile Picture
    10 on at

    Thank you very much for your help!

    Somehow the FirstName of the lead is set to the subject name, if it is null during create.

    Regards

    Andreas

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans