SQL语句 update 字段=字段+字符串 拼接

本文探讨了一条具体的SQL更新语句,分析了如何通过concat函数将特定字符串添加到已有用户名之后,实现数据库中用户信息的更新。这条语句展示了SQL语言在修改数据方面的强大能力。

update user_info set user_name = concat(user_name,'呵呵呵') where user_name = '哈哈哈';

转载于:https://www.cnblogs.com/wangfeihu/p/11388797.html

if (!"Wound Closure".equals(buName)){ String dt1Sql = "select id,chu_ext_id from " + mainTablename + "_dt1 where mainid = '" + mainId + "'"; logger.writeLogInfo(this.getClass().getName(), ACTION_NAME + " action main dt1Sql:" + dt1Sql); rs.executeQuery(dt1Sql); int lineItem = 0; while (rs.next()){ String id = Util.null2String(rs.getString("id")); String chuExtId = Util.null2String(rs.getString("chu_ext_id")); lineItem = lineItem + 10; String updateSql = "update " + mainTablename + "_dt1 set line_item=" + lineItem + " where id = '" + id + "'"; innerRs.execute(updateSql); String updateChuExtSql = "update uf_chu_ext set line_item=" + lineItem + ",qy=" + qy + ",ddfqr=" + creater + ",sqrq='" + currentDate + "',sqrxm='" + sqrxm + "',sqrdm='" + sqrdm + "',shr='" + shrmc + "',zdsapcode='" + shrdm + "',ejmc='" + ejmc + "',fj='" + fj + "' where id = '" + chuExtId + "'"; logger.writeLogInfo(this.getClass().getName(), ACTION_NAME + " action main updateChuExtSql:" + updateChuExtSql); innerRs.execute(updateChuExtSql); } } else { String dt2Sql = "select id,chu_ext_id from " + mainTablename + "_dt2 where mainid = '" + mainId + "'"; logger.writeLogInfo(this.getClass().getName(), ACTION_NAME + " action main dt2Sql:" + dt2Sql); rs.executeQuery(dt2Sql); int lineItem = 0; while (rs.next()){ String id = Util.null2String(rs.getString("id")); String chuExtId = Util.null2String(rs.getString("chu_ext_id")); lineItem = lineItem + 10; String updateSql = "update " + mainTablename + "_dt2 set line_item=" + lineItem + " where id = '" + id + "'"; logger.writeLogInfo(this.getClass().getName(), ACTION_NAME + " action main updateSql:" + updateSql); innerRs.execute(updateSql); String updateChuExtSql = "update uf_chu_ext set line_item=" + lineItem + ",qy=" + qy + ",ddfqr=" + creater + ",sqrq='" + currentDate + "',sqrxm='" + sqrxm + "',sqrdm='" + sqrdm + "',shr='" + shrmc + "',zdsapcode='" + shrdm + "',ejmc='" + ejmc + "',fj='" + fj + "' where id = '" + chuExtId + "'"; logger.writeLogInfo(this.getClass().getName(), ACTION_NAME + " action main updateChuExtSql:" + updateChuExtSql); innerRs.execute(updateChuExtSql); } } logger.writeLogInfo(this.getClass().getName(), "*************** " + ACTION_NAME + " End ***************"); } catch (Exception e){ e.printStackTrace(); logger.writeLogInfo(this.getClass().getName(), "*************** " + ACTION_NAME + " Exception:" + e.getMessage()); return failureInfo(requestInfo, requestid, "提示:" + ACTION_NAME + "异常"); } return Action.SUCCESS; }这段代码怎么对sqrq进行更新的
最新发布
10-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值