Contents

1 View?
2 Indexed View 曙(2005)
3 ロ襦襯 企豌 伎 覦覯
4 谿瑚襭
5 覿 觀


1 View? #

'觀壱企' 螻 蠏碁 '觀'. 願係..

2 Indexed View 曙(2005) #

  • SCHEMABINDING 旧 伎 .
  • 蠍一 企 覈 키마.이블명螻 螳 2Part 覈豺 伎 .
  • COUNT_BIG() 螳 伎 .
  • Unique Clustered Index襯 燕伎 .
  • view top(100 percent) ~ order by 襯 貅一企 view襯 覲伎ロ讌 .

    蟆 伎?

SELECT ROW_NUMBER() OVER(...) RowNum FROM 企 WHERE RowNum BETWEEN 1 and 10

3 ロ襦襯 企豌 伎 覦覯 #

  1. 襾殊 Loopback 襷 覯襯 襷.
  2. SELECT * FROM OPENQUERY (Loopback, 'Exec myDB.<db_owner>.<sp_name>') 螻 螳 伎.
  3. るジ 覦覯朱 2覯 蟆郁骸襯 View襦 襷.

4 谿瑚襭 #

5 覿 觀 #

--企
create table dbo.em_log_201309 
(
    tran_date datetime
,   val int
)

create table dbo.em_log_201310
(
    tran_date datetime
,   val int
)
go

create clustered index cix_tran_date
on dbo.em_log_201309(tran_date)

create clustered index cix_tran_date
on dbo.em_log_201310(tran_date)
go

create view v_em_log
as
select tran_date, val from dbo.em_log_201309
where tran_date between '20130901' and '20130930'
union all
select tran_date, val from dbo.em_log_201310
where tran_date between '20131001' and '20131031'
go

--讌 譟郁唄 譴  企襷 一危磯ゼ 讓 觸
select * from dbo.v_em_log
where 1=1
and tran_date >= '20131011' 
and tran_date < '20131012'