ChrisM@Work (5/3/2013)
ChrisM@Work (5/3/2013)
IgorMi (5/3/2013)
<<snip>>Queries having WHERE clause connected by AND operators are evaluated from left to right in the order they are written.
What is the source for this statement? It's completely wrong.
Hi
I admit the source was not good. I examined the issue in more details and yours code
does not works. It reports an converting type of error
SELECT
SUM(x.FloatAmount)
FROM filetransaction ft
CROSS APPLY (
SELECT FloatAmount = CASE
WHEN ISNUMERIC(ft.amount) = 1 THEN CAST(ft.amount AS FLOAT)
ELSE 0 END
) x
WHERE 1 = 1
This works.
SELECT sum(convert(float,ft.amount))
FROM filetransaction ft
WHERE ISNUMERIC(rtrim(ltrim(ft.amount)))=1 and ft.amount not like '%['','',''$'']%'
I used http://www.sqlservercentral.com/articles/IsNumeric/71512/
Regards
Igor Micev,My blog: www.igormicev.com