Collections:
Converting Character Strings to Numeric Values in MySQL
How To Convert Character Strings to Numeric Values in MySQL?
✍: FYIcenter.com
You can convert character strings to numeric values by using the CAST(string AS DECIMAL) or CAST(string AS SIGNED INTEGER) function as shown in the following examples:
SELECT CAST('4123.45700' AS DECIMAL) FROM DUAL;
4123.46
-- Very poor conversion
SELECT CAST('4.12345700e+3' AS DECIMAL) FROM DUAL;
4123.46
-- Very poor conversion
SELECT CAST('4123.45700' AS SIGNED INTEGER) FROM DUAL;
4123
SELECT CAST('4.12345700e+3' AS SIGNED INTEGER) FROM DUAL;
4
-- Very poor conversion
⇒ Using IN Conditions in MySQL
⇐ Converting Numeric Values to Character Strings in MySQL
2018-03-28, 4165🔥, 0💬
Popular Posts:
How to download Microsoft SQL Server 2005 Express Edition in SQL Server? Microsoft SQL Server 2005 E...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
What Are Date and Time Functions in MySQL? MySQL offers a number of functions for date and time valu...
What Happens to the Current Transaction If a START TRANSACTION Is Executed in MySQL? If you are in a...
What Are Bitwise Operations in SQL Server Transact-SQL? Bitwise operations are binary operations per...