Hello,
we have one Problem in our CRM System. When a User is Member in more than 20 Teams he get a Generic SQL Error Message.
User in 20 Groups -> No Problem. User in 21 Groups -> SQL Error.
In the Trace we found this:
>Crm Exception: Message: Generic SQL error., ErrorCode: -2147204784, InnerException: System.Data.SqlClient.SqlException (0x80131904): Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird. 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.SqlDataReader.TryHasMoreRows(Boolean& moreRows) at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) at System.Data.SqlClient.SqlDataReader.Read() at Microsoft.Crm.CrmDataReader.Read() at Microsoft.Crm.BusinessEntities.BusinessProcessObject.FillEntityCollectionFromDataReader(BusinessEntityCollection entities, IDataReader reader, EntityExpression entityExp, Boolean useEntityExpression, String aggregateLimitExceededName, Boolean quickFindRecordLimitCheckRequired, ExecutionContext context) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.QueryAndFillEntityCollection(CrmDbConnection dbConnection, IDbCommand dbCommand, BusinessEntityCollection entities, EntityExpression entityExp, PagingHelper pagingHelper, Boolean useEntityExpression, String aggregateLimitExceededName, ExecutionContext context) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, PagingHelper pagingHelper, ExecutionContext context, Boolean needToSetRowVersion, Boolean isVersionNumberRequestedInRetrieve) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoRetrieveMultiple(BusinessEntityCollection entities, EntityExpression entityExp, DatabaseQueryTarget queryTarget, ExecutionContext context, Boolean needToSetRowVersion, Boolean isVersionNumberRequestedInRetrieve) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.RetrieveMultiple(EntityExpression entityExpression, DatabaseQueryTarget queryTarget, ExecutionContext context) at Microsoft.Crm.ObjectModel.UserQueryServiceInternal`1.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context) ClientConnectionId:75f3e2c7-d003-417d-b7f0-cc2348811fdf Error Number:512,State:1,Class:16A4B7E148-3011-4164-AAA8-D5BEF55C6C76
The Problem is here because it gets more than 1 Result:
SELECT id from System.Collections.Generic.List`1[Microsoft.SqlServer.Server.SqlDataRecord])
The subquery has returned more than one value. This is not allowed if the subquery follows =, !=, <, <=, > or >= or is used as an expression.
and it refers to:
where POA.PrincipalId in ('34823431-06d6-e911-a81d-000d3a47fa69',(SELECT id from System.Collections.Generic.List`1[Microsoft.SqlServer.Server.SqlDataRecord])) and POA.ObjectTypeCode = 4230 and ((POA.AccessRightsMask|POA.InheritedAccessRightsMask) & 1) = 1)
Does anyone one what is the Problem here? We cant find out yet and think this is a Bug.
Kind regards,
David