--自己做个税率表,参考如下:
create table 税率表 (
rank int ,
baseIncome numeric(18,2) ,
overmin numeric(18,2),
overmax numeric(18,2) ,
taxs numeric(18,6)
)insert 税率表 select
1, 2000, 0 , 1000 , 0.05
union all select
2, 2000, 1000 , 3000 , 0.1
union all select
3, 2000, 3000 , 6000 , 0.15
union all select
4, 2000, 6000 , 10000 , 0.2
union all select
5, 2000, 10000, 15000 , 0.25gocreate proc pr_计算税金
@income numeric(18,2)
asselect sum(case when @income>baseIncome+overmax then overmax-overmin else @income-baseIncome-overmin end *taxs) as 税金
from 税率表
where baseIncome+overmin<=@incomegoexec pr_计算税金 2500
--25
exec pr_计算税金 3500
--100
exec pr_计算税金 9500
--1000exec pr_计算税金 12000
--1500
create table 税率表 (
rank int ,
baseIncome numeric(18,2) ,
overmin numeric(18,2),
overmax numeric(18,2) ,
taxs numeric(18,6)
)insert 税率表 select
1, 2000, 0 , 1000 , 0.05
union all select
2, 2000, 1000 , 3000 , 0.1
union all select
3, 2000, 3000 , 6000 , 0.15
union all select
4, 2000, 6000 , 10000 , 0.2
union all select
5, 2000, 10000, 15000 , 0.25gocreate proc pr_计算税金
@income numeric(18,2)
asselect sum(case when @income>baseIncome+overmax then overmax-overmin else @income-baseIncome-overmin end *taxs) as 税金
from 税率表
where baseIncome+overmin<=@incomegoexec pr_计算税金 2500
--25
exec pr_计算税金 3500
--100
exec pr_计算税金 9500
--1000exec pr_计算税金 12000
--1500
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货