Two conversion methods
CAST method
CAST (data to be converted AS target data type)
CAST(GETDATE() AS varchar(10))
CONVERT method
1. Do not specify the format
CONVERT (target data type, data to be converted)
CONVERT (varchar(10),GETDATE())
2. Specify the format
CONVERT (target data type, data to be converted, Style)
CONVERT (varchar(10),GETDATE(),20)