1、ID和DJH组合成主键:
update YWLBMCGJHHZ2 set GYSBM=(select f5 from tempData where f1=ID and DJH=f2) ,
GFJC=(select f7 from tempData where f1=ID and DJH=f2)
where ID=(select f1 from tempData where f1=ID and DJH=f2) and DJH=(select f2 from tempData where f1=ID and DJH=f2)
2、转换为decimal,并保留2位小数:
update YWLBMCGJHHZ2 set BWBJZJ= cast(BWBJZJ as decimal(18,2)) where NY=’2020年6月’
3、字段为空的时候取0,并转换为decimal保留2位小数
select isUpdate,* from YWLBMCGJHHZ2 where
cast(case when BWBJZJ=” then ‘0’ else BWBJZJ end as decimal(18,2))=cast(case when BWBJZJ2=” then ‘0’ else BWBJZJ2 end as decimal(18,2))
and GYSBM=GYSBM2
版权声明:本文为tangliuqing原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。