INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

'Internal error: An expression services limit has been reached. Please look for potentially complex

'Internal error: An expression services limit has been reached. Please look for potentially complex

'Internal error: An expression services limit has been reached. Please look for potentially complex

(OP)
Hi

When i execute my report, i get an error, 'Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.'

below is the query, Please help me simplify


SELECT Date,
SUM(Four) No_of_QA_CASEs_allocated,
SUM(One) Team_Leader_review_results_FROM_quality_ASsessor,
SUM(Five) No_of_CASEs_sent_for_moderation,
SUM(Six) No_of_moderated_surveys_returned_to_Team_Leader,
SUM(Three) No_of_CASEs_FINalized_By_Agent,
SUM(Seven) No_of_CASEs_FINalised_Auto_Completed

FROM(
SELECT az.DATE Date,
az.QACASENo,
CASE WHEN Status = 'Quality ASsessor evaluation for origINal case case sent to Team Leader review' THEN 1 ELSE 0 END One,
--SUM(CASE WHEN Status = 'Quality ASsessor evaluation hAS been submitted for origINal CASE' THEN 1 ELSE 0 END) Two,
CASE WHEN Status = 'Quality Evaluation case fINalised' THEN 1 ELSE 0 END Three,
CASE WHEN Status = 'Quality Evaluation case has been INitiated for evaluation of origINal CASE' THEN 1 ELSE 0 END Four,
CASE WHEN Status = 'Quality evaluation case sent to Specialist for 2nd review' THEN 1 ELSE 0 END Five,
CASE WHEN Status = 'Quality Specialist evaluation for original CASE sent to Team Leader for review' THEN 1 ELSE 0 END Six,
CASE WHEN Status = 'Team Lead assessment case auto completed' THEN 1 ELSE 0 END Seven
FROM(
SELECT CASENo QACASENo,
Status,
Date
FROM StatusTracks
WHERE Date BETWEEN @DateFROM and @DateTo

) az INNER JOIN

(
SELECT QACASENO,
Date,
TeamMember,
an.TEAMLEADERSID
FROM
(
SELECT DistINct QACASENO,
Date,
TeamMember
FROM(
SELECT
suv.CASEClASsification,
suv.Date,
suv.EvaluationDate,
suv.EvaluationType,
suv.QACASENO,
suv.SurveyName,
suv.Tier,
suv.StepNo,
c.TaxType,
c.Area,
c.CASENO OrigCASENo,
c.OrigCASEDate,
c.TeamMember
FROM
(
SELECT ss.ASsessorID,
ss.CASEClASsification,
ss.Date,
ss.EvaluationCASENo,
ss.EvaluationDate,
ss.EvaluationType,
ss.QACASENO,
ss.SpecialistID,
ss.StepNo,
ss.SurveyName,
ss.TeamLeaderID,
ss.Tier
FROM
(
SELECT Date EvaluationDate,
CASEClASsification,
DATE,
CASE WHEN SYSID = 381970529 THEN ASsignedRole ELSE '' END ASsessorID,
CASE WHEN SYSID = 1250902731 THEN ASsignedRole ELSE '' END TeamLeaderID,
CASE WHEN SYSID = 1734455418 THEN ASsignedRole ELSE '' END SpecialistID,
QACASENO,
EvaluationCASENo,
COALESCE(Tier, 'No Tier') Tier,
SurveyName,
EvaluationType,
StepNo,
QABUSINESSAREA
FROM CASEsSurvey
) ss
--WHERE QACASENO IN (1456587, 1456362, 1456583, 1456819, 1456823, 1456817, 1456880,1454203, 1454204)
WHERE DATE BETWEEN @DateFROM and @DateTo
And CASEClASsification IN (@CASEClASsification)
And EvaluationType IN (@EvaluationType)
And SurveyName IN (@SurveyName)
And Tier IN (@Tier)
And QABUSINESSAREA IN (@QABusINessArea)

) suv

LEFT OUTER JOIN
(
SELECT CASENO,
TaxType,
OrigCASEDate,
TeamMember,
Area
FROM(
SELECT CASENO,
TMSTAMP,
DateCreated OrigCASEDate,
CASE CharINdex('\',USRID) WHEN 0 THEN USRID
ELSE right(USRID ,Len(USRID) - CharINdex('\',USRID)) END TeamMember,
AreaCode + ' : ' + Area Area,
CASE WHEN REFNO IN (1, 8, 11) THEN 'ITS'
WHEN REFNO IN (2, 5, 6) THEN 'PAYE'
WHEN REFNO = 3 THEN 'VAT'
WHEN REFNO IN (4, 9, 10) THEN 'Customs' ELSE 'NullTax' END TaxType
FROM CASES
) aa
WHERE aa.TaxType IN (@TaxType)
AND aa.Area IN (@Area)
And TeamMember IN (@TeamMember)

) c On c.CASENO = suv.EvaluationCASENo



) alls LEFT OUTER JOIN (SELECT AccessorName AccessorName, AccessorSID, Started, StepNo
FROM TempAccessor
WHERE AccessorSID IN (@QAASsessorSID)
AND CAST(Started AS Date) BETWEEN @DateFROM and @DateTo

) acc On acc.StepNo = alls.StepNo
and alls.Date = CAST(acc.Started AS Date)

LEFT OUTER JOIN (SELECT StepNo, TeamLeaderName, TeamLeaderSID, Started
FROM TempTeamLeader
WHERE CAST(Started AS Date) BETWEEN @DateFROM and @DateTo
--GROUP by Started, TeamLeaderName, TeamLeaderSID
) tl On tl.StepNo = alls.StepNo
and alls.Date = CAST(tl.Started AS Date)

LEFT OUTER JOIN (SELECT StepNo, SpecialistSID, Started
FROM TempSpecialist
WHERE SpecialistSID IN (@QASpecialistSID)
AND CAST(Started AS Date) BETWEEN @DateFROM and @DateTo

) spl On spl.StepNo = alls.StepNo
and alls.Date = CAST(spl.Started AS Date)

LEFT OUTER JOIN (SELECT StepNo, TeamLeaderName, TeamLeaderSID, Started
FROM TempTeamLeader2Review
WHERE CAST(Started AS Date) BETWEEN @DateFROM and @DateTo
--GROUP by Started, TeamLeaderName, TeamLeaderSID
) tl1 On tl1.StepNo = alls.StepNo
and alls.Date = CAST(tl1.Started AS Date)

--
) aa LEFT OUTER JOIN (SELECT AGENTSID,
TEAMLEADERSID
FROM AGENTTEAMLEAD
WHERE TEAMLEADERSID IN (@TeamLeaderSID)) an on aa.TeamMember = an.AGENTSID
) aq on az.Date = aq.Date
AND aq.QACASENO = az.QACASENo
GROUP By az.QACASENo, az.Status, az.DATE
) yy
GROUP by Date

RE: 'Internal error: An expression services limit has been reached. Please look for potentially complex

how many nested tables do you have in total? what version of sql?

RE: 'Internal error: An expression services limit has been reached. Please look for potentially complex

(OP)
I have 5 tables and its SQL Server 2008

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close