Why do who have a number field as a string in the db in the first place? You'll lose lots of db-side operations on numbers in this form.
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
| [reply] |
That doesn't make any sense, unless, as agentM suggest, your number field is represented internally as a string.
While you might have some unusual reason for doing so, it's not a good idea.
If possible, I'd put the burden of conversion on the database. Depending on what you're using, and how you're querying it, you might be able to use
SELECT INT(field) FROM table
-or-
SELECT CONVERT(NUMERIC (10,2),field) FROM table
good luck! | [reply] [d/l] [select] |
That doesn't make any sense, unless, as agentM suggest, your number field is represented internally as a string.
Actually, it's likely that the database is storing the numbers as numbers, but that the format used when a number is retrieved from the database specifies commas.
For example, in Oracle SQL*PLUS:
14:23:48 FOCX> desc mytable
Name Null? Type
----------------------------------------- -------- ----------------
ID NUMBER(7)
14:23:56 DB> select id from mytable;
Press <enter> to continue...
ID
-------
1000
1001
14:23:59 DB> set numformat 999,990
14:24:06 DB> /
Press <enter> to continue...
ID
--------
1,000
1,001
| [reply] [d/l] |