在SQL Server 2008 中如何实现第三列的数值等于第一列和第二列的数值之和。

如题所述

可以用计算列来实现
如建表时可用如下写法
create table t1
(col1 int not null,
col2 int not null,
col3 as col1 + col2,
)
如表已存在可用如下方式来增加计算列
alter table t1 add col3 as col1 + col2
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-12-29
update 表名 set colum3=colum1+colum2
第2个回答  2012-12-29
select colum1,colum2, colum1+colum2
相似回答