方法 1、
convert(expression using character_set);
convert(‘123456789‘ using ascii);
方法 2、
cast(expresion as type character set = character_set);
cast(‘abc‘ as varchar(16) character set = utf8);
注意:
这里是不可以使用varchar类型的
如:
select cast(‘abc‘ as char(100) character set utf8); ?
select cast(‘abc‘ as varchar(100) character set utf8); ×
select cast(‘abc‘ as varchar character set utf8); ×
时间: 2024-10-07 13:13:21