Quantcast
Viewing all articles
Browse latest Browse all 12963

TRIGGERS TOPIC I AM GETTING ERROR AS Msg 213, Level 16, State 1, Procedure tr_employee1_insert, Line 6 Column name or number of supplied values does not match table definition.

/*FIRST TABLE*/

create table Employee1(
empid int,
empname varchar(20),
salary int,
gender varchar(10),
depid int)
insert into Employee1 values(1,'jitendra',500000,'m',100)

/*2 ND TABLE*/

create table audit(
empid int,
auditdata varchar(50)) 

 NOW I AM APPLYING TRIGGER

   

 /* triggers demo for after insert*/
 alter trigger tr_employee1_insert
 on  Employee1 for insert
 as begin
 declare @id int
 select @id=empid from inserted
 insert into audit values ('new employee is inserted with id=' + CAST(@id as nvarchar(5))+'is added at'+CAST(GETDATE() as nvarchar(20)))
 end
 insert into employee1 values (9,'shubham',110000,'m',200)

PLEASE HELP ME TO SOLVE


Viewing all articles
Browse latest Browse all 12963

Trending Articles