Collections:
CONVERT() - Converting Numeric Expression Data Types in SQL Server
How To Convert Numeric Expression Data Types using the CONVERT() Function in SQL Server Transact-SQL?
✍: FYIcenter.com
If you want to convert the data type of a numeric expression to a new data type, you can use the CONVERT(data_type, expression) function. The tutorial exercise below shows you how to use the CONVERT() function:
-- FLOAT converted to NUMERIC by CONVERT() DECLARE @pi FLOAT(24); SET @pi = 3.141592E+00; SELECT CONVERT(NUMERIC(5,2), @pi); GO 3.14 -- FLOAT converted to NUMERIC by CONVERT() DECLARE @x FLOAT(24); SET @x = 12345.12E+00; SELECT CONVERT(NUMERIC(10,5), @x); GO 12345.12012 -- FLOAT converted to INT by CONVERT() DECLARE @x FLOAT(24); SET @x = 12345.12E+00; SELECT CONVERT(INT, @x); GO 12345
⇒ CONVERT() - Converting Character Strings to Numeric Values in SQL Server
⇐ CAST() - Converting Numeric Expression Data Types in SQL Server
⇑ Numeric Expressions and Functions in SQL Server Transact-SQL
2017-03-27, 4850🔥, 0💬
Popular Posts:
How to change the data type of an existing column with "ALTER TABLE" statements in SQL Server? Somet...
Can You Drop an Index Associated with a Unique or Primary Key Constraint in Oracle? You can not dele...
How Many Groups of Data Types in MySQL? MySQL support 3 groups of data types as listed below: String...
How to download Microsoft SQL Server 2005 Express Edition in SQL Server? Microsoft SQL Server 2005 E...
How to format a number of bytes in a human-readable unit using the FORMAT_BYTES() function? FORMAT_B...