updaate tab set coll = substring(coll,1,10) + "abc";
解决方案 »
- mysql 连接出错 报错代码2002
- 当前记录集不支持更新。这可能是提供程序的限制,也可能是选定锁定类型的限制
- mysql数据从5.0导入到4.1.7乱码问题怎么解决啊?
- 请问在Mysql中如何用mysql存储过程返回表集
- 请教一个SQL语法,大家帮忙看一下,谢谢
- create database出错.初学者求教.谢谢
- 求在mysql中的一条sql语句
- 对于MSSQL中的varchar(2000),varchar(6000),varchar(8000)MySQL用什么类型
- 从MySql往SQL Server2000导数据时遇到的问题。
- 怎么做数据库
- 刚学mysql,我在mysql里建了一个数据库,如设置访问我的数据库的密码。(在线等待)
- mysql登录的问题!!
这样怎算?
Returns a substring len characters long from string str, starting at position pos.
mysql> SELECT SUBSTRING('Quadratically',5,6);
-> 'ratica'SUBSTRING(str,pos)
Returns a substring from string str starting at position pos:
mysql> SELECT SUBSTRING('Quadratically',5);
-> 'ratically'update tab set coll = substring(coll,1,10) + abc';
从coll的1个字符开始取10个字符,加上'abc',再写入coll中,如果coll原始值为'1234567890XYZ',则更新之后为'1234567890abc'了。更多函数见:http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#String_functions
为'1234567890XYZ',则更新之后为'abc'了。
为什么呢,我用的INNODB;
Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form:
mysql> SELECT CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql> SELECT CONCAT('My', NULL, 'QL');
-> NULL
mysql> SELECT CONCAT(14.3);
-> '14.3'