SELECT CONVERT(char(8),GETDATE(),112)
In the above example CONVERT() offers superior functionality to CAST(),CONVERT ()supports a style parameter (the third argument above) that specifies the exact format to use when converting a datetime value to a character string.
|