I am trying to do an insert but it is giving an error stating that credits cannot be null but I am not providing null. Attached Screenshot
Code: Insert into [dbo].[Course] values (12,'Java',1,1,1);
Error: Msg 515, Level 16, State 2, Procedure trgAfterInsert, Line 31 Cannot insert the value NULL into column 'Credits', table 'DemoCollege.dbo.Course'; column does not allow nulls. INSERT fails. The statement has been terminated.
Trigger:
Create trigger trgAfterInsert2 ON [dbo].[Course]
After Insert
AS
Declare @cid int;
Declare @cname nvarchar(50);
Select @cid = i.CourseID from inserted i;
Select @cname = i.Title from inserted i;
Insert into dbo.CourseTemp values (@cid, @cname);
Print 'After insert trigger fired';
GO