Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert data types

Status
Not open for further replies.

iamsw00sh

Programmer
May 21, 2003
92
RO
MSSQL:

select convert(int, '111')
select convert(float, '111')

MySQL:

how is this made?

I am a total rookie ...
I just got a MySQL.chm ... and I cannot find it ...

thanks ;)

--
If I would be such a good coder as I like coding ... I would be the Best
 
from float into integer without rounding
Code:
SELECT TRUNCATE(5.82343434,0);

from float into integer with rounding

Code:
ROUND(X,D) 
Returns the argument X, rounded to a number with D decimals. If D is 0, the result will have no decimal point or fractional part: 
mysql> SELECT ROUND(1.298, 1);
        -> 1.3
mysql> SELECT ROUND(1.298, 0);
        -> 1

from int to float
Code:
SELECT int+0.000000;

gry online
 
from string to float is possible ?

--
If I would be such a good coder as I like coding ... I would be the Best
 
Code:
mysql> select '1333' + 0.00000;
+------------------+
| '1333' + 0.00000 |
+------------------+
|             1333 |
+------------------+
1 row in set (0.01 sec)

so it doesn't work as you expected

gry online
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top