Create a computed column : Column « Table « SQL Server / T-SQL Tutorial






3>
4> SET QUOTED_IDENTIFIER ON
5> GO
1>
2>
3> CREATE TABLE employee
4> (ID int NOT NULL,
5> total int NOT NULL,
6> count int NOT NULL,
7> AvgSharesPerShareholder AS (total/count) PERSISTED);
8>
9> select * from employee;
10> GO
ID          total       count       AvgSharesPerShareholder
----------- ----------- ----------- -----------------------

(0 rows affected)
1>
2> drop table employee;
3> GO
1>
2> SET QUOTED_IDENTIFIER OFF
3> GO
1>








3.3.Column
3.3.1.Create a computed column
3.3.2.Reporting Table Information
3.3.3.Designating a Column's Collation
3.3.4.A statement that changes the data type of a column
3.3.5.A statement that adds a new check constraint
3.3.6.A statement that adds a new column
3.3.7.A statement that drops a column