alter table Storage_kc add outQuantity as (SELECT SUM(Quantity_ck) FROM (SELECT Quantity_ck FROM ck1_ls UNION ALL SELECT Quantity_ck FROM ck2_sp UNION ALL SELECT Quantity_ck FROM ck3_jz ))
create function f_All()
returns int
as
begin
declare @s int
SELECT @s=SUM(Quantity_ck) FROM
(SELECT Quantity_ck FROM ck1_ls UNION ALL
SELECT Quantity_ck FROM ck2_sp UNION ALL
SELECT Quantity_ck FROM ck3_jz ) aa
return @s
end
go
alter table Storage_kc add outQuantity as dbo.F_ALL()