[英]MYSQL syntax error in CONVERT function
I have some problem in MYSQL syntax 我的MySQL语法有问题
This statement is work correctly 这句话工作正常
CONVERT(_latin1 'SOME-AR-TEXT' USING utf8));
But i don't need the 'SOME-AR-TEXT'
value, i need the value of some variable. 但是我不需要
'SOME-AR-TEXT'
值,我需要一些变量的值。
In other words, i tried to do this 换句话说,我试图做到这一点
CONVERT(_latin1 (SELECT some_variable) USING utf8));
But the console display syntax error. 但是控制台显示语法错误。
What can i do to get the value of some_variable
variable. 我该怎么做才能获取
some_variable
变量的值。
Thank you all 谢谢你们
SELECT CONVERT(some_variable USING UTF8) AS field_value
FROM MyTable
By your SQL fiddle it seems like you want to convert each field. 通过您的SQL摆弄,您似乎想要转换每个字段。 Why not just create the table with default charset latin?
为什么不使用默认字符集拉丁来创建表呢? In that way, you would not have to specifially convert each field.
这样,您就不必专门转换每个字段。
CREATE TABLE IF NOT EXISTS `example` (
`some_variable` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
And there is something wrong the terminology as well. 术语也有问题。 'some_variable" isn't really a variable but a column/field in the database-table example.
“ some_variable”实际上不是变量,而是数据库表示例中的列/字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.