求好手:一个根据大小对比修改数据的存储过程

求高手:一个根据大小对比修改数据的存储过程
一、表结构

CREATE TABLE [dbo].[Table_tc](
[zyno] [varchar](20) NULL,
[sa_qj] [varchar](50) NULL,
[sa_base] [decimal](18, 2) NULL,
[sa_float] [decimal](18, 2) NULL,
[sa_tc] [decimal](18, 2) NULL
) ON [PRIMARY]

二、测试值

insert into Table_tc(zyno,sa_qj,sa_base,sa_float,sa_tc) values('zy001','2012-08',2500,2400,99)
insert into Table_tc(zyno,sa_qj,sa_base,sa_float,sa_tc) values('zy002','2012-08',2000,2400,100)

三、用存储过程实现功能: 

      根据  sa_base > (sa_float  + sa_tc) 大小对比。 根据对比结果清空sa_base,或(sa_float、sa_tc)

四、效果如下:

zy001 2012-08 2500.00 0 0
zy002 2012-08 0 2400.00 100.00
------最佳解决方案--------------------

update tb
set sa_base = (case when sa_base > sa_float+sa_tc then sa_base else 0 end),
set sa_float = (case when sa_base > sa_float+sa_tc then 0 else sa_float end),
set sa_tc = (case when sa_base > sa_float+sa_tc then 0 else sa_tc end)

------其他解决方案--------------------

update Table_tc
set sa_base = (case when sa_base > sa_float+sa_tc then sa_base else 0 end),
sa_float = (case when sa_base > sa_float+sa_tc then 0 else sa_float end),
sa_tc = (case when sa_base > sa_float+sa_tc then 0 else sa_tc end)

------其他解决方案--------------------
oh,god.写错了,2楼的。多了两个set 。 继续头晕中!
------其他解决方案--------------------
to:AcHerat
  哈哈哈哈。抢分心切啊~可以理解。
------其他解决方案--------------------
感谢各位!