Ask a Question related to Coldfusion Database Access, Design and Development.
-
Explorer5 #1
Converting a "string" to a number
How do i convert a string (which is really a number, but just saved in the DB as 'text') into a number that can be added and subtracted?
Explorer5 Guest
-
"Error Creating Control" and "Cast from String"
I'm creating a custom date control. In appearance, it's just a textbox and a button. It has three custom properties: CalDate, CalDateType and... -
#26292 [Opn->Bgs]: substr returns "0" for any offset on the string "0"
ID: 26292 Updated by: sniper@php.net Reported By: ravacholp at hotmail dot com -Status: Open +Status: ... -
#25763 [Opn->WFx]: Why the string "1.10" is equal to the string "1.1"?
ID: 25763 Updated by: pollita@php.net Reported By: jparneodo at yahoo dot fr -Status: Open +Status: ... -
#25763 [NEW]: Why the string "1.10" is equal to the string "1.1"?
From: jparneodo at yahoo dot fr Operating system: RH7.2 PHP version: 4.3.3 PHP Bug Type: Strings related Bug description: ... -
convert visual basic "string" data type to DB2 "blob"
Does anyone know if a visual basic string data type can be converted to DB2 blob datatype? I have all data in XML files and I use Visual Basic to... -
byron1021 #2
Re: Converting a "string" to a number
This would be for MS SQL, but there is probably similar syntax in MySQL and
Access select cast(col1 as int) + col2 + cast(col3 as numeric(9,2) from table
It gets a little stick for MS SQL 'text' datatypes (not varchar or char), you
would need to cast the text data type to a varchar first, then cast to a int,
numeric, etc. Also when adding int's and numeric, look out for rounding
issues. int + numeric I believe will round to an int, you would need to cast
both as numeric to get a floating number back
byron1021 Guest
-
paross1 #3
Re: Converting a "string" to a number
With Access, you can use CInt() or CLng() functions to convert a string to integer or LONG, whichever is applicable.
SELECT CInt(col_name) AS num_col
FROM whatever
WHERE stuff
Phil
paross1 Guest
-
kyle969 #4
Re: Converting a "string" to a number
For Oracle use this: SELECT NVL( TO_NUMBER(col_txt), 0) * amt_nbr This
converts any nulls to 0. If you are certain there are no nulls, just use the
to_number(). There are other functions to convert to different datatypes, but
this wil work for most applications.
kyle969 Guest



Reply With Quote

