SQL Server/T-SQL Tutorial/Table/Computed Columns — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:46, 26 мая 2010
Computed columns are (by default) virtual columns not physically stored in the table.
Their values are recalculated each time they are referenced in a query.
CREATE TABLE orders
(orderid INT NOT NULL,
price MONEY NOT NULL,
quantity INT NOT NULL,
orderdate DATETIME NOT NULL,
total AS price * quantity PERSISTED,
shippeddate AS DATEADD (DAY, 7, orderdate))
GO
drop table orders;
GO