mysql concat乱码问题解决

[ 2008-10-31 15:19:47 | Author: zhenhua ]
Font Size: Large | Medium | Small
concat(str1,str2)
当concat结果集出现乱码时,大都是由于连接的字段类型不同导致,如concat中的字段参数一个是varchar类型,一个是int类型或doule类型,就会出现乱码。

解决方法:
利用mysql的字符串转换函数CONVERT将参数格式化为char类型就可以了。

举例:
concat('数量:',CONVERT(int1,char),CONVERT(int2,char),'金额:',CONVERT(double1,char),CONVERT(double2,char))

Comments Feed Comments Feed: http://www.zhenhua.org/feed.asp?q=comment&id=627
UTF-8 Encoding Trackback URL: http://www.zhenhua.org/trackback.asp?id=627

There is no comment on this article.

If you feel this site you find this information helpful, please click on the donation, which is voluntary,Thank you.
Post Comment
Smilies
[arrow] [biggrin] [confused] [cool]
[cry] [eek] [evil] [exclaim]
[frown] [idea] [lol] [mad]
[mrgreen] [neutral] [question] [razz]
[redface] [rolleyes] [sad] [smile]
[surprised] [twisted] [wink]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code