标题:插入数据报错如下。
只看楼主
laplas
Rank: 1
等 级:新手上路
帖 子:110
专家分:0
注 册:2006-2-28
 问题点数:0 回复次数:2 
插入数据报错如下。
An explicit value for the identity column in table '系统参数表' can only be specified when a column list is used and IDENTITY_INSERT is ON.
这个怎么解决阿
搜索更多相关主题的帖子: 数据 column IDENTITY identity 系统 
2006-03-20 09:38
laplas
Rank: 1
等 级:新手上路
帖 子:110
专家分:0
注 册:2006-2-28
得分:0 
INSERT statement conflicted with COLUMN FOREIGN KEY constraint '帐簿初始化表_科目代码_fk'. The conflict occurred in database 'caiwubook', table '科目表', column '科目代码'.
The statement has been terminated.
这个应该怎么解决
2006-03-20 09:41
LouisXIV
Rank: 6Rank: 6
等 级:贵宾
威 望:25
帖 子:789
专家分:0
注 册:2006-1-5
得分:0 

第一个问题是你的插入语句涉及了索引列的插入
比如
create table #temp
(id int identity(1,1) primary key,
name varchar(255))

create table #temp2
(id int identity(1,1) primary key,
name varchar(255))
insert into #temp2
values('John')

insert into #temp
select * from #temp2

这样做就会出现一样的报错信息,解决方法是指定插入字段的时候不要包含索引列。

写insert语句的时候个人建议全字段指定插入,不要随便用全字段插入(*记号)
这样维护数据库的时候也不会对存储过程什么的造成影响。


2006-03-20 22:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-51505-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.351885 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved