CONVERT:

The CONVERT function is an important conversion tool. It is used to convert a datatype or expression to another datatype. The syntax of this command is

CONVERT (data_type[(length)], expression [, style])

where

data_type[(length)] is the datatype that you want to convert to

expression is the argument expression that you are converting

style is a parameter to format datetime data

Examples

CONVERT(NUMERIC(5,2),'199.95')

will result 199.95

CONVERT(DATETIME,'08/15/99'+''+'17:00:00')

will result August 15, 1999 05:00PM

 

Back to the homepage