例:現(xiàn)在有個(gè)需求,需要將一批訂單號(hào)的中的日期20170599 替換成新的日期20180699
滕州ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)建站的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18980820575(備注:SSL證書合作)期待與您的合作!
修改前:
select * from ICStockBill where FBillNo like 'WHFC201705%' order by FBillNo
結(jié)果:
FInterID FDate FBillNo
209234 2017-04-30 00:00:00.000 WHFC201705990001
209235 2017-04-30 00:00:00.000 WHFC201705990002
209236 2017-04-30 00:00:00.000 WHFC201705990003
209237 2017-04-30 00:00:00.000 WHFC201705990004
.......
209239 2017-04-30 00:00:00.000 WHFC2017059900999
修改后
用replace函數(shù):
格式: repalce(字段名,要替換的值,替換后的新值)
如果替換的是具體的值可以把字段替換成相應(yīng)的值,或通過條件指定。
update ICStockBill set FBillNo=REPLACE(fbillno,'20170508','20180510') where FBillNo between 'WHFC201705080001' and 'WHFC201705089999'
FInterID FDate FBillNo
209234 2017-04-30 00:00:00.000 WHFC201806990001
209235 2017-04-30 00:00:00.000 WHFC201806990002
209236 2017-04-30 00:00:00.000 WHFC201806990003
209237 2017-04-30 00:00:00.000 WHFC201806990004
......
209239 2017-04-30 00:00:00.000 WHFC201806990999
為了實(shí)現(xiàn)這個(gè)功能,百度后也走了不走彎路,特留此文,僅作記錄,希望幫到有需要的人。