T-SQL 101: 80 Converting data types with CAST and CONVERT
The rich set of data types in SQL Server and the T-SQL language are great. But sometimes, you need to change a value from one data type to another. The output from the commands above is:
CAST
ANSI SQL provided a way to do this.
CAST is the ANSI SQL way to convert from one data type to another. The syntax is basically:
CAST(ValueToConvert AS NewDataType)
And you can use it where you would have used an expression or constant.
2021-01-11