locked
CRM 2015: Generic SQL error - Invalid column name 'EntityName'. RRS feed

  • Question

  • Hi,

    anyone having issues with importing unmanaged/managed solutions or deleting plugin processing steps in CRM 2015 on-premise? 

    This is an updated environment from CRM 2011 -> 2013 -> 2015.

    After the latest migration from 2013 to 2015 this error comes up with every solution import. The CRM 2015 has Update 0.1.

    Trace from the server when deleting a plugin processing step looks like:

    >Crm Exception: Message: Generic SQL error., ErrorCode: -2147204784, InnerException: Microsoft.Crm.CrmException: Generic SQL error. ---> System.Data.SqlClient.SqlException: Invalid column name 'EntityName'.
       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.CrmCascadeDBHandler.<>c__DisplayClass1.<CollectForCascadeWrapper>b__0(IDbCommand cmd)
       at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.Collect(String cascadingSql, Int32 entityOtc, ExecutionContext context, CollectDelegate CollectDelegate)
       at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.CollectForDelete(IEnumerable`1 entityIds, Int32 entityOtc, ExecutionContext context)
       at Google.Crm.BusinessEntities.CascadeEngine.CascadeDeleteDB(IEnumerable`1 parentEntityIds, Int32 parentEntityObjectTypeCode, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.CascadeEngine.Delete(IEnumerable`1 entityIds, Int32 entityObjectTypeCode, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Delete(BusinessEntityMoniker moniker, ExecutionContext context)
       at Microsoft.Crm.ObjectModel.SdkMessageProcessingStepServiceInternal`1.DeleteInternal(BusinessEntityMoniker moniker, ExecutionContext context, Boolean verifySku, Boolean checkInternalStage, SdkMessageProcessingStep existingStep)
       at Microsoft.Crm.ObjectModel.SdkMessageProcessingStepServiceInternal`1.Delete(BusinessEntityMoniker moniker, ExecutionContext context)
       --- End of inner exception stack trace ---
    [2015-05-06 15:07:27.636] Process: w3wp |Organization:802203e7-a50f-4686-8b84-86b85d9dc77c |Thread:   25 |Category: Platform |User: 60e63534-bfe3-41e8-868f-3e42706f4523 |Level: Error |ReqId: 13382e8f-d994-48a4-ad81-782c06befda0 | MessageProcessor.Execute  ilOffset = 0x171
    at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x171
    at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
    at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x16E
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode)  ilOffset = 0x1EE
    at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode)  ilOffset = 0x2D
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode)  ilOffset = 0x26
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at DataSource.Delete(String entityName, Guid entityId, IOrganizationContext context)  ilOffset = 0x0
    at EntityProxy.Delete()  ilOffset = 0x0
    at DeleteDialogPage.ConfigureForm()  ilOffset = 0x76D
    at AppUIPage.OnPreRender(EventArgs e)  ilOffset = 0x13
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x6D3
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x33
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
    >MessageProcessor fail to process message 'Delete' for 'sdkmessageprocessingstep'.
    [2015-05-06 15:07:27.636] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   25 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 13382e8f-d994-48a4-ad81-782c06befda0 | ExceptionConverter.ConvertMessageAndErrorCode  ilOffset = 0x23B
    at ExceptionConverter.ConvertMessageAndErrorCode(Exception exception, Int32& errorCode)  ilOffset = 0x23B
    at ExceptionConverter.ToSingleFaultOther(Exception exception)  ilOffset = 0x2B
    at ExceptionConverter.ToSingleFaultUnTyped(Exception exception)  ilOffset = 0x3A
    at ExceptionConverter.ConvertToFault(Exception exception)  ilOffset = 0x69
    at ExceptionConverter.TryConvertToFaultExceptionInternal(Exception exception, Boolean createNewFaultException, FaultException`1& faultException)  ilOffset = 0x6D
    at FaultHelper.ConvertToFault(Exception exception)  ilOffset = 0x0
    at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode)  ilOffset = 0x26
    at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x34
    at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    at DataSource.Delete(String entityName, Guid entityId, IOrganizationContext context)  ilOffset = 0x0
    at EntityProxy.Delete()  ilOffset = 0x0
    at DeleteDialogPage.ConfigureForm()  ilOffset = 0x76D
    at AppUIPage.OnPreRender(EventArgs e)  ilOffset = 0x13
    at Control.PreRenderRecursiveInternal()  ilOffset = 0x54
    at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x6D3
    at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  ilOffset = 0x3C
    at Page.ProcessRequest()  ilOffset = 0x14
    at Page.ProcessRequest(HttpContext context)  ilOffset = 0x33
    at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
    >System.Data.SqlClient.SqlException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #28A57083: System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'EntityName'.
    >   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.CrmCascadeDBHandler.<>c__DisplayClass1.<CollectForCascadeWrapper>b__0(IDbCommand cmd)
    >   at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.Collect(String cascadingSql, Int32 entityOtc, ExecutionContext context, CollectDelegate CollectDelegate)
    >   at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.CollectForDelete(IEnumerable`1 entityIds, Int32 entityOtc, ExecutionContext context)
    >   at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeDeleteDB(IEnumerable`1 parentEntityIds, Int32 parentEntityObjectTypeCode, ExecutionContext context)
    >   at Microsoft.Crm.BusinessEntities.CascadeEngine.Delete(IEnumerable`1 entityIds, Int32 entityObjectTypeCode, ExecutionContext context)
    >   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Delete(BusinessEntityMoniker moniker, ExecutionContext context)
    >   at Microsoft.Crm.ObjectModel.SdkMessageProcessingStepServiceInternal`1.DeleteInternal(BusinessEntityMoniker moniker, ExecutionContext context, Boolean verifySku, Boolean checkInternalStage, SdkMessageProcessingStep existingStep)
    >   at Microsoft.Crm.ObjectModel.SdkMessageProcessingStepServiceInternal`1.Delete(BusinessEntityMoniker moniker, ExecutionContext context)

    • Edited by helgi27 Wednesday, May 6, 2015 3:49 PM
    Wednesday, May 6, 2015 3:23 PM

All replies

  • Do you get the same or similar error when import a solution?

    Also I really liked the Easter egg in the trace, hope that other ppl will find it too.

    -Ragnar

    Thursday, May 7, 2015 9:57 AM
  • Yes it doesn't matter whether it's a managed or unmanaged solution that's being imported.

    Both give the same error that points down to the Deletion of a SdkMessageProcessingStep which throws:  Invalid column name 'EntityName'.

    Well done spotting the easter egg. Good to know that someone is reading through the stack trace.

    Thursday, May 7, 2015 12:43 PM
  • No one else having this issue?
    Monday, May 11, 2015 4:33 PM
  • I am also seeing this issue in a clean 2015 (not upgraded) environment also with 0.1 installed. I've also noticed that in Deployment Manager it shows an update being available for my Organization, but when I try to apply it, it fails. I'm speculating, but I wonder if 0.1 is somehow partially installed, and the database schema doesn't match that which is expected by the solution import process?

    It looks like others are also having this (possibly related) issue: https://social.microsoft.com/Forums/en-US/0de1985d-072d-4e38-a4f4-d5069758dee2

    Wednesday, May 13, 2015 9:16 AM
  • Thanks Toffee Blue, that was the thing, the Organization update won't install and Microsoft has acknowledged the bug. The fix is coming in Update 0.2 in a few weeks time but an internal fix is available from Microsoft beforehand if you know Bill Gates.

    Monday, May 18, 2015 2:43 PM
  • https://community.dynamics.com/crm/f/117/t/158085?pi51685=2#responses

    1. Make a backup of the file MetadataDiffs.xml from “C:\Program Files\Microsoft Dynamics CRM\Setup\Serviceability\Latest\Actions_Org\Install”

    2. Open the file MetadataDiffs.xml from “C:\Program Files\Microsoft Dynamics CRM\Setup\Serviceability\Latest\Actions_Org\Install”

    3. Remove the entry about the index “cndx_BusinessDataLocalizedLabel”. This is found at the very end of the file:

       <index Name="cndx_BusinessDataLocalizedLabel">

         <EntityId>4ba1569e-3c9c-4d9f-99ea-b61fb08d7f97</EntityId>

         <IsClustered>1</IsClustered>

         <IsUnique>1</IsUnique>

         <IndexType>6</IndexType>

        <IsPrimaryKey>0</IsPrimaryKey>

         <attributes>

           <attribute AttributeId="d88e1df3-b5b3-42f3-9ffa-007f22951dd4" IsSystemManaged="1" order="0" />

           <attribute AttributeId="bb23d3c8-8d18-40d3-9519-66101a8cae34" IsSystemManaged="1" order="1" />

           <attribute AttributeId="976e1053-5faa-4c3f-be6e-669acfec9d5a" IsSystemManaged="1" order="2" />

           <attribute AttributeId="e81341c4-4d4a-4977-98eb-6597fcde2cc4" IsSystemManaged="1" order="3" />

         </attributes>

       </index>

    4.Close Deployment Manager

    5. Start Deployment Manager

    6. Start the organization update from Deployment manager.

    7. Run the following query on the organization DB to manually recreate the index.

    IF EXISTS (SELECT * FROM sys.indexes WHERE name = 'cndx_BusinessDataLocalizedLabel' AND OBJECT_NAME(object_id) = 'BusinessDataLocalizedLabelBase') DROP INDEX [cndx_BusinessDataLocalizedLabel] ON [BusinessDataLocalizedLabelBase];

    IF NOT EXISTS (SELECT * FROM sys.indexes WHERE NAME = 'cndx_BusinessDataLocalizedLabel' AND OBJECT_NAME(object_id) = 'BusinessDataLocalizedLabelBase')

    BEGIN TRY

     CREATE UNIQUE CLUSTERED INDEX [cndx_BusinessDataLocalizedLabel] ON [BusinessDataLocalizedLabelBase]([ObjectId] ASC, [ObjectIdTypeCode] ASC, [ObjectColumnNumber] ASC, [LanguageId] ASC) WITH (FILLFACTOR = 80, MAXDOP = 4, SORT_IN_TEMPDB = ON, ONLINE = ON)

    END TRY

    BEGIN CATCH

     CREATE UNIQUE CLUSTERED INDEX [cndx_BusinessDataLocalizedLabel] ON [BusinessDataLocalizedLabelBase]([ObjectId] ASC, [ObjectIdTypeCode] ASC, [ObjectColumnNumber] ASC, [LanguageId] ASC) WITH (FILLFACTOR = 80, MAXDOP = 4, SORT_IN_TEMPDB = ON)

    END CATCH

    8. Restore the file MetadataDiffs.xml to its original state using the backup taken at step 1.

    • Proposed as answer by djwIA Monday, June 22, 2015 9:32 PM
    Wednesday, May 20, 2015 1:21 PM
  • Hello All,

    I am also come across the same scenario and was going through the steps in this forum thread.

    In my case the file MetadataDiffs.xml does not contain the <index Name="cndx_BusinessDataLocalizedLabel">

    but it does contains the <index Name="BusinessDataLocalizedLabel_Fulltext">

    kindly support me in resolving the issue.

    Monday, November 9, 2015 7:29 AM
  • This is all about the trouble due to the update 0.1 in microosft crm 2015,

     we need to uninstall this from the mscrm server.

    Note :- first take the backup of the database.

    and after that create the new organization , because the same old organization doesn't work for importing the solution.

    I have done this on separate blank organization , i don't know whether the previous db backup which we keep before uninstalling this will work or not.

    Tuesday, November 10, 2015 11:48 AM