Collections:
CAST() - Converting Numeric Expression Data Types in SQL Server
How To Convert Numeric Expression Data Types using the CAST() 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 CAST(expression AS data_type) function. The tutorial exercise below shows you how to use the CAST() function:
-- FLOAT converted to NUMERIC by CAST() DECLARE @pi FLOAT(24); SET @pi = 3.141592E+00; SELECT CAST(@pi AS NUMERIC(5,2)); GO 3.14 -- FLOAT converted to NUMERIC by CAST() DECLARE @x FLOAT(24); SET @x = 12345.12E+00; SELECT CAST(@x AS NUMERIC(10,5)); GO 12345.12305 -- FLOAT converted to INT by CAST() DECLARE @x FLOAT(24); SET @x = 12345.12E+00; SELECT CAST(@x AS INT); GO 12345
⇒ CONVERT() - Converting Numeric Expression Data Types in SQL Server
⇐ Converting Numeric Data Types by Assignment Operations in SQL Server
⇑ Numeric Expressions and Functions in SQL Server Transact-SQL
2017-03-27, 3366🔥, 0💬
Popular Posts:
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
How To Verify Your PHP Installation in MySQL? PHP provides two execution interfaces: Command Line In...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...