22,300
社区成员




--测试数据
if not object_id(N'Tempdb..#A') is null
drop table #A
Go
Create table #A([fname] nvarchar(23),[f_101] BIGINT,[Fxzxm] BIGINT,[FCombobox] nvarchar(27),[Famount] decimal(18,2))
Insert #A
select N'aaa',1,114534,N'FPA1134',25 union all
select N'bbb',0,114537,N'FPA1138',108
GO
if not object_id(N'Tempdb..#C') is null
drop table #C
Go
Create table #C([FNAME] nvarchar(23),[FPA1134] int,[FPA1138] int,[FPA1139] int,[FPA1140] int)
Insert #C
select N'aaa',0,0,0,0 union all
select N'bbb',0,0,0,0
Go
--测试数据结束
UPDATE #C
SET [FPA1134] = CASE
WHEN FCombobox = 'FPA1134' THEN
Famount
ELSE
FPA1134
END,
[FPA1138] = CASE
WHEN FCombobox = 'FPA1138' THEN
Famount
ELSE
FPA1138
END,
[FPA1139] = CASE
WHEN FCombobox = 'FPA1139' THEN
Famount
ELSE
FPA1139
END,
[FPA1140] = CASE
WHEN FCombobox = 'FPA1140' THEN
Famount
ELSE
FPA1140
END
FROM #A
WHERE #A.fname = #C.FNAME;
SELECT * FROM #C