Database Reference
In-Depth Information
create table dbo.Orders2014_06
(
OrderId int not null,
OrderDate datetime2(0) not null,
OrderNum varchar(32) not null,
OrderTotal money not null,
CustomerId int not null,
/* Other Columns */
constraint PK_Orders2014_06
primary key clustered(OrderId)
with (data_compression=row),
constraint CHK_Orders2014_06
check (OrderDate >= '2014-06-01' and OrderDate < '2014-07-01')
) on [FASTSTORAGE];
create nonclustered index IDX_Orders2014_04_CustomerId
on dbo.Orders2014_06(CustomerId)
with (data_compression=row)
on [FASTSTORAGE]
go
create view dbo.Orders(OrderId, OrderDate, OrderNum
,OrderTotal, CustomerId /*Other Columns*/)
with schemabinding
as
select OrderId, OrderDate, OrderNum
,OrderTotal, CustomerId /*Other Columns*/
from dbo.Orders2012_01
union all
select OrderId, OrderDate, OrderNum
,OrderTotal, CustomerId /*Other Columns*/
from dbo.Orders2012_02
/* union all -- Other tables */
union all
select OrderId, OrderDate, OrderNum
,OrderTotal, CustomerId /*Other Columns*/
from dbo.Orders2014_06;
Figure 15-2 shows the physical data layout of the tables.
Search WWH ::




Custom Search