Thanu Thanu - 2 months ago 6
MySQL Question

How to change the data type in a view?

In MySQL is there a way to change the data type of a field, other than the original data type, without having an intermediate table involvement?

Answer

Have a look at 12.10. Cast Functions and Operators

The CAST() function takes an expression of any type and produces a result value of a specified type, similar to CONVERT().

CAST(expr AS type)

and

CONVERT(expr,type), CONVERT(expr USING transcoding_name)

Comments