specifying Datatype while adding computed field

31 Views Asked by At

This is in addition to the following question in the link.

Creating calculated fields in sql

The listed commands worked beautifully. However, my result when viewed in object explorer and Design is not rounded up to the nearest integer. First, would setting the datatype to numeric (9) as such accomplish the specified task?

 alter table dbo.equi add employment numeric (9) AS ((m1+m2+m3)/3)
1

There are 1 best solutions below

0
On

alter table dbo.equi add employment AS CAST((m1+m2+m3)/3 AS numeric(9));