Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error converting CRM 2011 to CRM 2013 during upgrade

Posted on by Microsoft Employee

Trying to import an organization from CRM 2011 to CRM 2013 and we are receiving the following error.

CRM 2011 has rollup 18 and CRM 2013 has SP1 and rollup 5 installed. The SQL server is 2008 R2 SP3. I am not sure what does “Ambiguous column name” mean here.

  

20:08:42|   Info| Setting organization state.  New state = Failed

20:08:43|  Error| Upgrade Organization with Id=d020c31b-3454-48e1-94ed-049677f29729 failed with Exception:

System.Exception: Error.ActionFailed Microsoft.Crm.Tools.Admin.UpgradeDatabaseAction ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: Ambiguous column name 'EntityId'.

   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.TryConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

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

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

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

   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)

   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)

   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()

   at Microsoft.Crm.Setup.DiffBuilder.RetrieveAttributeMoveData(ISqlExecutionContext sqlContext, String selectQuery, Boolean selectIsIdentityColumn)

   at Microsoft.Crm.Setup.DiffBuilder.MoveInheritedEntityDataToNewColumns()

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

   at Microsoft.Crm.Setup.Database.DllMethodAction.Execute(Guid organizationId)

   at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseInfo releaseInfo, Boolean isInstall)

   at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase, Boolean isInstall)

   at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase)

   at Microsoft.Crm.Tools.Admin.InstallDatabaseAction.Do(IDictionary parameters)

   at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)

   --- End of inner exception stack trace ---

   at Microsoft.Crm.Setup.Shared.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)

   at Microsoft.Crm.Setup.Shared.Installer.Install(IDictionary stateSaver)

   at Microsoft.Crm.Tools.Admin.OrganizationOperation.Install(IDictionary stateSaver)

   at Microsoft.Crm.Tools.Admin.OrganizationUpgrader.Install(IDictionary stateSaver)

   at Microsoft.Crm.Tools.Admin.OrganizationOperation.Execute()

   at Microsoft.Crm.Tools.Admin.ImportOrganizationInstaller.ImportAndUpgrade(OrganizationInfo organizationInfo)

*This post is locked for comments

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    Hi moonwalker,

    Happy you were able to get this working.

    If this answer resolved you case, please mark it as verified, so that it will help other community members.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    After I raised COMPATIBILITY_LEVEL to 100, which is 2008 R2, I was able to restore and import the database successfully from the deployment manager. As a quick summary, you are right. You can't upgrade CRM from 2011 to 2013 SP1 directly and you have to upgrade it first and then apply SP1. I guess this rule applies when upgrading to 2015 and 16 as well. Again, thanks for your help and time!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    The SQL server of CRM 2011 is 2008 R2 SP3 and the SQL server of 2013 CRM is 2012 SP1. I will set the compatibility level to 100 and post the result here. Thank you again for your direction.

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    Hi moonwalker,

    Do you have System Admin access on the SQL Server database?

    Can you check if you can set the compatibility level of the current database to a higher level as is suggested by the message using the SET COMPATIBILITY_LEVEL option of ALTER DATABASE.

    See below link:

    docs.microsoft.com/.../alter-database-transact-sql-compatibility-level

    What version of SQL Server was CRM before, and did you upgrade SQL Server?

    Let me know.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    I uninstalled CRM 2013 and re-installed it without SP1 because I can't uninstall SP1 and tried to import the database again from CRM 2011. It was a brand new CRM 2013 test environment. This time I got a different error.

    It seems stored procedure was failed with installation. I appreciate any advice.

    ------------------------------------------------------

    22:30:48| Error| An error occurred when trying import and upgrade organization database DELLV2.InfoCubic_MSCRM:
    Microsoft.Crm.CrmException: Upgrade Organization with Id=d020c31b-3454-48e1-94ed-049677f29729 failed with Exception:

    System.Exception: Action Microsoft.Crm.Tools.Admin.UpgradeDatabaseAction failed. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Crm.CrmException: Error installing sp with name=p_GrantInheritedAccess
    Incorrect syntax near 'MERGE'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the SET COMPATIBILITY_LEVEL option of ALTER DATABASE.

    Incorrect syntax near the keyword 'AS'. ---> System.Data.SqlClient.SqlException: Incorrect syntax near 'MERGE'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the SET COMPATIBILITY_LEVEL option of ALTER DATABASE.

    Incorrect syntax near the keyword 'AS'.

    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.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout)

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

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

    at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command)

    at Microsoft.Crm.CrmDbConnection.InternalExecuteNonQuery(IDbCommand command, Boolean capturePerfTrace)

    at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command, Boolean impersonate, Boolean capturePerfTrace)

    at Microsoft.Crm.Metadata.SqlHelper.ExecuteBatches(IDbTransaction transaction, IDbCommand sqlCommand)

    at Microsoft.Crm.Setup.StoredProcedureService.InstallStoredProcedureInternal(StoredProcedureData spData, SqlExecutionContext sqlContext)

    --- End of inner exception stack trace ---

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    You can run SQL Profiler Trace on the SQL Server during installation, however as you mention that you are not a SQL expert, it might be hard to find what you are looking for.

    Do you have an IT staff/consultant that could help you with going over the SQL Profile logs?

    You might also try and open an incident with Microsoft to troubleshoot.

    Sorry I don't have a better answer.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    Thanks for your advice and direction. Can you tell me in details how to start a SQL query? I am not an SQL expert.

  • SergeyT Profile Picture
    SergeyT 310 on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    You can try to trace problematic SQL query. It may give you hint on how to fix it.

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    Try seeing if you get the same errors after uninstalling SP1.

    If you are still getting these errors (and don't get a different response from the forum), you might have to create a new 2013 environment (temporarily), import the 2011 database and import the organization to 2013, and then backup the newly created 2013 database, import to your 2013 SP1 environment.

    I know it's a lot of work, but I am not sure if you have another alternative.

    You can also try MS Support see if they have any other resolution for you.

    Hope this helps and good luck.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error converting CRM 2011 to CRM 2013 during upgrade

    Aric, thanks for your quick response. It seems Rollup 5 can be uninstalled. but SP1 can't be uninstalled from control panel. I read similar errors, which were caused by not applying SP1. That's why I thought I should install SP1 first before importing.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans