SQL CAST Function

Example

Convert a value to an int datatype:

SELECT CAST(25.65 AS int);

Definition and Usage

The CAST() function converts a value (of any type) into a specified datatype.

Tip: Also look at the CONVERT() function.

Syntax

CAST(expression AS datatype(length))

Continue reading SQL CAST Function