更新数据库时将原数据 123456 替换成 123456|6789 ;其 123456|6789 中 123456 为原数据库数据。
请问用 SQL 语句怎样写?
eg:
UPDATE test SET test=test*1.5 WHERE test = 2;
没看懂
请说明白字段类型,以及转化前后数据之间的规则?
是什么数据库?
试试这个可不可以
update test set test=concat(test,"|6789") where test="123456";
我之前查过这方面资料,但大多数都是只有加减乘除之类的,没有字符串加减的。不过之前用 MS SQL 时好像记得是可以的。
等会再去查查资料。
试试这个
update test set test=convert(varchar(6),test)+convert(varchar(5),"|6789") where test="123456";
字符串合并就是concat()函数,没有任何疑问。
这是我实际中应用的例子:
update verification set email=concat(email,@hotmail.com)
不错,concat()是应该可以的。
会不会数据问题或语法问题!
update table set col1=col1+asdf
这样就可以了吧
oracle数据库:
update test set test=test || "6789" where test="123456";