SQL help need to convert char to real or double

I have a field of type char which contains real numbers only. I need to convert it so I can do a sum on it.

That is all.

What flavor of SQL? Oracle has TO_NUMBER(in_str) as a function, but it will die a terrible death if there are any non-numeric characters anywhere.

Can’t speak as to other DBs.

Tried that. I’m using the sql that comes in ‘microsoft enterprise manager’

Microsoft SQL Server should do an implicit conversion, so you should be able to just add them and get a sum. If not use CAST or CONVERT function, such as CAST(char_var AS number).

For that matter, Oracle does implicit conversion, too.

For more help, find the “Books Online” button on the Start menu in the “Microsoft SQL Server” group.

The CAST function worked (with type ‘real’ though) Thanks for the help.

darn, too slow :frowning: