Error message when you run an Advanced Find query in Microsoft Dynamics CRM 4.0: "Microsoft CRM Unhandled Error Details: Server Error in '/' Application"

Article translations Article translations
Article ID: 952815 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

When you run an Advanced Find query in Microsoft Dynamics CRM 4.0, you receive the following error message:
Microsoft CRM Unhandled Error Details:
Server Error in '/' Application.

The variable name '@statecode0' has already been declared. Variable names must be unique within a query batch or stored procedure. Must declare the scalar variable "@DeletionStateCode1".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The variable name '@statecode0' has already been declared. Variable names must be unique within a query batch or stored procedure.
Must declare the scalar variable "@DeletionStateCode1".

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[SqlException (0x80131904): The variable name '@statecode0' has already been declared. Variable names must be unique within a query batch or stored procedure.
Must declare the scalar variable "@DeletionStateCode1".]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857370
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734982
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
This problem occurs if the query contains multiple status attributes.

RESOLUTION

This problem is fixed in the latest cumulative update rollup for Microsoft Dynamics CRM 4.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
949256 Microsoft Dynamics CRM 4.0 updates and hotfixes

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information about the terminology that is used to describe Microsoft software updates, click the following article numbers to view the articles in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
887283 Microsoft Business Solutions CRM software hotfix and update package naming standards

Properties

Article ID: 952815 - Last Review: January 20, 2012 - Revision: 3.2
APPLIES TO
  • Microsoft Dynamics CRM 4.0
Keywords: 
kberrmsg kbfix kbautohotfix kbexpertiseinter kbmbsmigrate kbqfe kbhotfixserver KB952815

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com