本文介绍了在数据库表中插入数据时出现问题,该表没有主键但是没有复合键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的数据库中有一张桌子,我正在节省教师的出勤率
其中栏目为
Teacher_ID,Date,Arrival_time,Departure_time
teacherID和date作为复合键
但是数据没有插入这里
它给出了没有主键的例外
i've a table in my Database where i'm saving the attendance the of teachers
where columns are given as
Teacher_ID , Date , Arrival_time , Departure_time
teacherID and date are working as composite key
but data is not inserting here
it is giving exception that it has no primary key
推荐答案
CREATE PROCEDURE [dbo].[Sp_Add_MENUS]--[Sp_Add_MENUS] is the name of Stored Procedure
--Declare Below Your Columns
@MenuName AS NVARCHAR(50),
@PareId AS int,
@FrmId AS NVARCHAR(50),
@COMMENTS AS NVARCHAR(100),
@IsReadOnly AS varchar,
@IsVisible AS VARCHAR(1),
@RESULT AS NVARCHAR(50) OUTPUT
AS
BEGIN
-- Insert statements for procedure here
INSERT INTO TBLCFGMENUS(MenuName,PareId,FrmId,IsReadOnly,IsVisible,Comments)
VALUES (@MenuName,@PareId,@FrmId ,@IsReadOnly,@IsVisible,@COMMENTS)
SET @Result = N'Data Inserted Succssfuly'
END
这篇关于在数据库表中插入数据时出现问题,该表没有主键但是没有复合键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!