日期:2014-05-18 浏览次数:20506 次
create table t ( a int primary key, b int not null, c int not null, d as CAST(b AS DECIMAL(18,2))/c ) INSERT INTO t(a,b,c) SELECT 1,2,3 UNION ALL SELECT 3,6,7 UNION ALL SELECT 6,7,8 SELECT * FROM t /* a b c d ----------- ----------- ----------- --------------------------------------- 1 2 3 0.6666666666666 3 6 7 0.8571428571428 6 7 8 0.8750000000000 */