Set Statistics io On -- 打开查看IO

-- 1.将数据归档简单操作,按年分,可以分成若干个表
select * into Log2011
from Log
where StartTime between '2011-1-1' and '2011-12-31'

-- 2.为这些表创建一个约束
alter table log2011
add constraint CK_2011 check (StartTime between '2011-1-1' and '2011-12-31')

-- 3.为这些表建立一个视图
--
 这里可以测试,如果用约束和不用约束差别很大
ALTER view V_AllDocLog
as
select * from log2009
union all
select * from Log2010
union all
select * from Log2011
go

相关文章:

  • 2021-12-10
  • 2021-04-27
  • 2022-12-23
  • 2021-05-28
  • 2022-01-13
  • 2021-06-14
  • 2021-06-16
  • 2022-03-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案