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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SQL Error When selecting Associated Contracts from an Account

(0) ShareShare
ReportReport
Posted on by

I upgraded my CRM 2011 database to CRM 2013.  Now when I try to open the Associated Contracts from an Account I get:  A SQL Server error occurred. 

I ran the SQL Profiler and get the following exception error:

Incorrect syntax near the keyword 'select'.
Incorrect syntax near ')'.
Incorrect syntax near ')'.

This is the statement that is failing:

select
 DISTINCT  top 51 "contract0".Title as "title"
, "contract0".StateCode as "statecode"
, "contract0".ActiveOn as "activeon"
, "contract0".ExpiresOn as "expireson"
, "contract0".ContractId as "contractid"
from
 ContractBase as "contract0" (NOLOCK) 
where
 (("contract0".ContractId in (select contract0.ContractId from Contract as contract0 WITH (NOLOCK) where exists (select RollupId from #RollupIds where RollupId = contract0.CustomerId)select contract0.ContractId from Contract as contract0 WITH (NOLOCK) where exists (select RollupId from #RollupIds where RollupId = contract0.BillingCustomerId)))) order by
 "contract0".Title asc
, "contract0".ContractId asc

I believe this is Standard CRM and no customizations.  Can someone please give me a fix or work around?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: SQL Error When selecting Associated Contracts from an Account

    Hi Stephanie,

    Thanks for posting the question. You are correct this is a standard behavior.

    This is a known issue, the fix for which was released in CRM 2013 update roll ups.

    I have accessed the contracts on the accounts in my test environment (with UR 2 - 06.00.0002.0051) and it is working fine. Can you please check if you are still seeing the issue on UR 2? (www.microsoft.com/.../details.aspx)

    If you are still seeing the issue, I  would recommend you to open a support incident, we can then investigate it further.

    As a simple workaround, you can create a sub grid on the Account form to show the contracts.

    Hope I have answered your question.

  • Community Member Profile Picture
    on at
    RE: SQL Error When selecting Associated Contracts from an Account

    I have already installed SP1.  This what I see when I go to the About screen when I am logged in to CRM:

    Micrsoft Dynamics CRM 2013 Service Pack 1 (SP1) (6.1.5.581) (DB 6.1.0.581)

  • Community Member Profile Picture
    on at
    RE: SQL Error When selecting Associated Contracts from an Account

    Hi Stephanie,

    Please log in a support case with MS. We will be able to further look into the issue.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans