Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql CAST(amount as float)

mysql> SELECT CAST(4 AS DECIMAL(4,3));
+-------------------------+
| CAST(4 AS DECIMAL(4,3)) |
+-------------------------+
|                   4.000 |
+-------------------------+
1 row in set (0.00 sec)

mysql> SELECT CAST('4.5s' AS DECIMAL(4,3));
+------------------------------+
| CAST('4.5s' AS DECIMAL(4,3)) |
+------------------------------+
|                        4.500 |
+------------------------------+
1 row in set (0.00 sec)

mysql> SELECT CAST('a4.5s' AS DECIMAL(4,3));
+-------------------------------+
| CAST('a4.5s' AS DECIMAL(4,3)) |
+-------------------------------+
|                         0.000 |
+-------------------------------+
1 row in set, 1 warning (0.00 sec)
Comment

cast float mysql

SELECT
    integer_column + 0.0 AS float_column
Comment

parsing float to int in mysql

SELECT CONVERT(150, CHAR);
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql ifnull 
Sql :: mysql set id auto increment 
Sql :: oracle trigger after logon on database 
Sql :: change date format in oracle query 
Sql :: get duplicate records in sql 
Sql :: sql limit results returned 
Sql :: sql date get month 
Sql :: connectionstring mysql c# 
Sql :: how to import large sql file in phpmyadmin in ubuntu 
Sql :: count columns psql(PostreSQL) 
Sql :: sql in array query 
Sql :: update with inner join postgres 
Sql :: add column if not exists mysql 
Sql :: postgresql find duplicates 
Sql :: check constraint in sql 
Sql :: select if then postgresql 
Sql :: mysql on duplicate key update 
Sql :: install sqlite npm 
Sql :: postgresql set auto increment value 
Sql :: select last row mysql 
Sql :: oracle select first row order by 
Sql :: how to drop all tables in sql 
Sql :: check if sql is installed 
Sql :: events mysql 
Sql :: update with select postgresql 
Sql :: oracle list grants on procedure 
Sql :: use float in sql server string 
Sql :: python sqlite data delete 
Sql :: mysql trim spaces 
Sql :: oracle drop sequence 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =