可以使用下面这样的语句来创建表:
CREATE TABLE [TestComputedColumns] (
[PK] [int] IDENTITY (1, 1) NOT NULL ,
[Length] [int] NOT NULL ,
[Width] [int] NOT NULL ,
[Height] [int] NOT NULL ,
[Coats] [int] NOT NULL CONSTRAINT [DF_TestComputedColumns_Coats] DEFAULT
(2),
[IncludeCeiling] [bit] NOT NULL CONSTRAINT
[DF_TestComputedColumns_IncludeCeiling] DEFAULT (0),
[Area] AS ((2 * ([Height] * [Length] + [Height] * [Width]) + [Length] *
[Width] * [IncludeCeiling]) * [Coats]),
CONSTRAINT [PK_TestComputedColumns] PRIMARY KEY CLUSTERED
(
[PK]
) ON [PRIMARY]
) ON [PRIMARY]
GO
Oracle 10g后也可类似的创建计算域.