December 1, 2016 at 3:41 pm
The column submittedmetricqnty is a varchar(8) column.
I get a error when I run the query . Why ? Because one row has a value '4,000.00'
How can modify the below SQL to only grab numeric values ( THE ISNUMERIC function does not work here )
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
Select
CASE WHEN submittedmetricqnty NOT LIKE '%,%' THEN
CAST ( submittedmetricqnty as DECIMAL(38,0 ) )*(1.0)
ELSE
NULL
END
from mhpdw2.transferdb.rx.rx4dclaims
December 1, 2016 at 4:32 pm
Are you sure that's the value that's actually throwing the error?
December 1, 2016 at 5:02 pm
ZZartin: Found the error. There was a value '4,000.00'
I managed to take care of that by doing a CAST( (CAST ( COL as MONEY )) as DECIMAL(38,0) )
That works! I am all set!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply