Link to home
Start Free TrialLog in
Avatar of portlight
portlightFlag for United States of America

asked on

cast mySQL string to double

I am having to pull a cost from a string....
 substr(l.details, instr(l.details , ':' ) +1)AS charge,

This works for doing the calculations correctly, HOWEVER when I to print the value is prints as an 'object'  not a string.

I have tried cast and convert....how can i get this above code to print the actual string out
Avatar of 5teveo
5teveo
Flag of United States of America image

Try

Cast (substr(l.details, instr(l.details , ':' ) +1), varchar(5))

or whatever size you need
Avatar of portlight

ASKER

That gave me an error at the ,

I did cast to a double but it created it as a zero.

The value I am looking to see is .70
Avatar of arnold
First make sure the extraction gets you the value out.
Can you post the string from which you want the data extracted?
ASKER CERTIFIED SOLUTION
Avatar of 5teveo
5teveo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial