日期:2014-05-17  浏览次数:20543 次

update语句问题
update fljh set LEFT(ltrim(fld_wl_bh),2) = upper(LEFT(ltrim(fld_wl_bh),2))
请帮忙看下此语句有何问题?

------解决方案--------------------

只能这样写,不可以直接搞

update fljh 
set fld_wl_bh=REPLACE(fld_wl_bh,LEFT(ltrim(fld_wl_bh),2),upper(LEFT(ltrim(fld_wl_bh),2)))


------解决方案--------------------
糾正如下:
update fljh set fld_wl_bh = ltrim(fld_wl_bh)
update fljh set fld_wl_bh = stuff(fld_wl_bh,1,2,upper(LEFT(fld_wl_bh,2)))
------解决方案--------------------

update fljh 
 set fld_wl_bh=upper(LEFT(ltrim(fld_wl_bh),2))
 where LEFT(ltrim(fld_wl_bh),2)=upper(LEFT(ltrim(fld_wl_bh),2))

------解决方案--------------------

update fljh SET fld_wl_bh=upper(LEFT(ltrim(fld_wl_bh),2))+LTRIM(RIGHT(fld_wl_bh,LEN(fld_wl_bh)-2))

------解决方案--------------------
update fljh set LEFT(ltrim(fld_wl_bh),2) = upper(LEFT(ltrim(fld_wl_bh),2))

set 后面的LEFT(ltrim(fld_wl_bh),2) 只是函数转化后的虚拟列,也就说是返回值,并不是真实存在的列。