This is a discussion on cast function problems within the MySQL Database forums, part of the Database Forums category; Hi, In one of my tables, one of the columns (Salary) is of type varchar(255). I want to conver ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
In one of my tables, one of the columns (Salary) is of type varchar(255). I want to conver it into int(11). When I do a test to see if get the result, I have the following problems. select cast(Salary as unsigned int) from mydb; Truncated incorrect INTEGER value: '150000.00' ie, if the Salary has a decimal point, it gives me an error. Any suggestions? Thanks. |
|
|||
|
Actually, I am trying to insert this salary value ( from varchar(255))
into a table which has a type int(11). Thats when I get this trouble. insert into mydb2 (select cast(Salary as unsigned int) from mydb) Truncated incorrect INTEGER value: '150000.00' mydb2 has Salary int(11); Thanks. On Apr 17, 5:39 pm, PGPS <premg...@gmail.com> wrote: > Hi, > In one of my tables, one of the columns (Salary) is of type > varchar(255). I want to conver it into int(11). When I do a test to > see if get the result, I have the following problems. > > select cast(Salary as unsigned int) from mydb; > > Truncated incorrect INTEGER value: '150000.00' > > ie, if the Salary has a decimal point, it gives me an error. Any > suggestions? > > Thanks. |