CAST

Use CAST to cast a value or expression to a data type. The first parameter is the expression or value. The second parameter is the data type for the result. If the value cannot be cast to the requested type, the result is NULL.

The supported data types for CAST are: varchar, date, datetime, datetime2, decimal, integer, bigint.

Syntax

CAST(expression AS data_type)