Calculated field in ORDER BY
Posted: Fri 01 Aug 2008 17:32
Hi guys,
Just moved into the very latest version 4.5 yesterday.
Previously used ver.3.80
After testing found strange behaviour:
when SQL statement contains something like that:
SELECT PeopleID, PeopleType,
PeopleTypeName =
CASE
WHEN PeopleType = 1 THEN 'Contact'
WHEN PeopleType = 2 THEN 'Vendor'
WHEN PeopleType = 3 THEN 'Customer'
ELSE 'Undefined'
END,
LastName, FirstName, ...
FROM People
ORDER BY PeopleTypeName, LastName
Such query works fine in SQL Analyser or in SMS SQL 2005, however
in DataSnap server ( we are using SDAC TMSQueries there)
failed with two problems:
1. query did not return all the results,
2. throwing exception kind of "Key violation'...
Removing PeopleTypeName from ORDER BY fixing the problem...
It was working OK in older SDAC...
What is the problem with newest release?
Best Regards
Just moved into the very latest version 4.5 yesterday.
Previously used ver.3.80
After testing found strange behaviour:
when SQL statement contains something like that:
SELECT PeopleID, PeopleType,
PeopleTypeName =
CASE
WHEN PeopleType = 1 THEN 'Contact'
WHEN PeopleType = 2 THEN 'Vendor'
WHEN PeopleType = 3 THEN 'Customer'
ELSE 'Undefined'
END,
LastName, FirstName, ...
FROM People
ORDER BY PeopleTypeName, LastName
Such query works fine in SQL Analyser or in SMS SQL 2005, however
in DataSnap server ( we are using SDAC TMSQueries there)
failed with two problems:
1. query did not return all the results,
2. throwing exception kind of "Key violation'...
Removing PeopleTypeName from ORDER BY fixing the problem...
It was working OK in older SDAC...
What is the problem with newest release?
Best Regards