SQL 2005 主键(非聚集索引)上为什么不能建立包含性的列?
 微软做这样限制的目的是什么?

解决方案 »

  1.   

    create table tbb(id int ,name varchar(10))
    alter table tbb alter column id int not null
    alter table tbb add constraint pk_id primary key(id)
    create index ix_id_name on tbb(id) include (name)
      

  2.   

    如果你在主键pk_id 增加 include (name) 试试?哈哈,不行了吧?
    前提是主键不能为默认生成聚集索引。
      

  3.   


    create table tbb(id int ,name varchar(10))
    alter table tbb alter column id int not null
    alter table tbb add constraint pk_id  primary key nonclusteRED(id)
    create index ix_id_name1 on tbb(id) include (name)
      

  4.   

    UP,带有包含性的索引,是为了减小IUD 对物理数据指针的移动,还可以减少物理读取,理由就是小麦说的,只读取了非聚集索引页
      

  5.   

    有如:SQL77 说的,根本就没这个语法,如果进UI界面也是灰色的,根本用不了
      

  6.   

    太理论了,参考:http://blog.csdn.net/htl258/archive/2009/09/01/4502943.aspx
    内有例子与【图片解析】
      

  7.   

    不好意思,剪贴版串位,http://www.cnblogs.com/gaizai/archive/2010/01/11/1644358.html多谢小麦