首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

在含聚集索引的表中 大量插入数据出现的有关问题

2012-01-18 
在含聚集索引的表中 大量插入数据出现的问题Table1ID主键自动增加nameTypeTable2ID

在含聚集索引的表中 大量插入数据出现的问题
Table1
ID     主键   自动增加  
name  
Type

======================

Table2
ID     主键   自动增加       aa_pk   是ID上的   聚集索引
name  
Type
==========================
目标   实现   把Table2的数据
中插入Table1中

==========================
insert   into   table1(name,Type)
select   name,Type   from   table2
==================================
出错   如下

不能在具备唯一索引aa_pk   的对象table1上插入健值不唯一的数据

++++++++++++++++++++++++++++++++++++++++++

这是为什么   ?这是为什么   ?这是为什么   ?这是为什么   ?这是为什么   ?

[解决办法]
Table1 如果为空
insert into Table1
select name,type from table2

[解决办法]
应该没问题的
[解决办法]
不好意思,更正一下
Table1
ID 主键 自动增加 aa_pk 是ID上的 聚集索引
name
Type


索引键应该不光ID列,你在查一下索引结构
[解决办法]
你先看看你的aa_pk 索引是怎么建的吧
如果真是在ID上,再看看ID是否是自动增加的

热点排行
Bad Request.