select CAST('2002-09-30 11:35:00' AS smalldatetime) - 1 (Minus) : CAST « Data Convert Functions « SQL Server / T-SQL Tutorial






2>
3> select CAST('2002-09-30 11:35:00' AS smalldatetime) - 1
4> GO

--------------------
 2002-09-29 11:35:00

(1 rows affected)








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