CAST() function allows us to convert values to another data type. However, it is not the only function that does this. In T-SQL, we also have the
CONVERT() function. Here is an example:
CONVERT(NUMERIC, HP) / Level AS Ratio
The difference is that this function needs two arguments: the first is the new data type, and the second is the value to convert. There are other differences as well, but they are for more advanced T-SQL usage, and we will not discuss them in this course.
CAST() complies with the ANSI standard, but
CONVERT() is specific to SQL Server. For simple conversions, we recommend the ANSI standard.