ms sql convert code example
Example 1: sql cast as
CAST('2006-04-25T15:50:59.997' AS date) AS Date,
CAST('2006-04-25T15:50:59.997' AS time) AS Time,
CAST('2006-04-25T15:50:59.997' AS datetime) AS Datetime,
Example 2: sql server convert string to date
Cast( '2011-07-07' as date ) as convertedDate
Example 3: sql convert
-- CAST Syntax:
CAST ( expression AS data_type [ ( length ) ] )
-- CONVERT Syntax:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )