插入时出现SQL Server错误 [英] SQL Server Error on Insert

查看:108
本文介绍了插入时出现SQL Server错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

empty

推荐答案

此错误的原因:
INSERT语句与FOREIGN KEY约束"FK_locationToEmployee_Employees"冲突.数据库"TimeOutServices"的表"dbo.Employees"的列"emp_id"中发生了冲突.该语句已终止

在locationToEmployee表中插入数据时,正在发送的值employee_id实际上在employees表中不存在.

您已指定employee_id作为外键.只需检查要提供给存储过程的 @EmpId 的值即可.该值必须在Employee表中丢失.您只能传递雇员表中存在的@EmpId值.
The reason for this error:
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_locationToEmployee_Employees". The conflict occurred in database "TimeOutServices", table "dbo.Employees", column ''emp_id''.The statement has been terminated

While you are inserting data in locationToEmployee table, you are sending a value of ''employee_id'' that actually does not exists in your employees table.

You have employee_id as a foreign key specified. Just check the value of @EmpId that you are supplying to your Stored procedure. That value must be missing in the Employee table. You can only pass those values for @EmpId that are present in employee table.


miltonraj写道:
miltonraj wrote:

我将尝试从数据库执行Ajax自动完成,如果运行该程序时出现错误"

I will try ajax auto complete from database,if I run that program got a error "


您现在已经更改了整个问题!您必须创建一个新问题,而不要更新旧问题!

请回滚您的更改并创建一个新问题.在更新或怀疑时,您需要更新现有问题.并不是您只能发布一个问题,并在一段时间内继续使用其他问题进行更新!

更新:将您的问题回滚到原始问题.创建一个新的发布您的新疑问.


You have changed the whole question now! You have to create a new question and not update the old one!

Kindly rollback your change and create a new question. At time of updates or doubts, you need to update the existing question. It''s not like you can post only one question and keep on updating it with different ones over a period of time!

UPDATE: Rolledback your question to original one. Create a new one to post your new doubt.


这篇关于插入时出现SQL Server错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆