-
SQL Server WHEN Clause returns Query plan error
The following SQL returns Query plan error:
SELECT
SELECT value = CASE -- (Level 1)
WHEN (SELECT VALUE = CASE -- (Level 2)
WHEN (SELECT Value = CASE -- (Level 3)
WHEN IsNull((Round(Cast(2 AS Float),6)), 0)
> IsNull((Round(Cast(1 AS Float),6)), 0)
THEN 'Y' ELSE 'N' END)
= 'Y'
THEN ( IsNull((Round(Cast(1 AS Float),6)), 0) )
ELSE( IsNull((Round(Cast(-1 AS Float),6)), 0) )
END)
>= -10 AND
(SELECT VALUE = CASE
WHEN (SELECT Value = CASE
WHEN IsNull((Round(Cast(2 AS Float),6)), 0)
> IsNull((Round(Cast(1 AS Float),6)), 0)
THEN 'Y' ELSE 'N' END)
= 'Y'
THEN ( IsNull((Round(Cast(1 AS Float),6)), 0) )
ELSE( IsNull((Round(Cast(-1 AS Float),6)), 0) )
END)
<= 10
THEN
(SELECT VALUE = CASE
WHEN (SELECT Value = CASE
WHEN IsNull((Round(Cast(2 AS Float),6)), 0)
> IsNull((Round(Cast(1 AS Float),6)), 0)
THEN 'Y' ELSE 'N' END)
= 'Y'
THEN ( IsNull((Round(Cast(1 AS Float),6)), 0) )
ELSE( IsNull((Round(Cast(-1 AS Float),6)), 0) )
END)
ELSE 0 END)
AS FormulaValue
The workaround I had was: To collapse Level 2/Level 3
(Passing Level 2 (THEN and ELSE) values to Level 3 (THEN
and ELSE), in other words, replacing 'Y' and 'N' of
Level 3 with THEN and ELSE values of Level 2)
If you find a solution or a better workaround, I will
appreciate your reply at "chikkuvarma@cs.com".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks