Data type conversion can be performed using the CAST() and CONVERT() functions. : CAST « Data Convert Functions « SQL Server / T-SQL Tutorial






5> SELECT CAST('123' AS Int)
6> GO

-----------
        123

(1 rows affected)
1> SELECT CAST('123.4' AS Decimal(9,2))
2> GO

-----------
     123.40

(1 rows affected)
1>








13.1.CAST
13.1.1.The syntax of the CAST function: CAST(expression AS data_type)
13.1.2.select CAST('2002-09-30 11:35:00' AS smalldatetime) + 1
13.1.3.select CAST('2002-09-30 11:35:00' AS smalldatetime) - 1 (Minus)
13.1.4.select CAST(CAST('2002-09-30' AS datetime) - CAST('2001-12-01' AS datetime) AS int)
13.1.5.Data type conversion can be performed using the CAST() and CONVERT() functions.
13.1.6.SELECT CAST('123.4' AS Decimal)
13.1.7.Use cast function in dynamic sql