C#, SQL Server, WCF, MVC and ASP .NET video tutorials for beginners http://www.youtube.com/user/kudvenkat/playlists In this video we will learn about triggers …
source
Please support this website by disabling your AdBlocker
Please contact with the webmaster of the website if you think something is wrong.
can i apply this trigger to multiple columns ?
As most of the people here is facing the same problem as me that after execution 'Column name or number of supplied values does not match table definition'.Please help us to explain this this
Fantastic video, thank you so much!
Hello venkat
you videos are very helpful..thank u so much for all videos..i am getting this error when i create trigger plz help me for resolving this issue ..
i understand the error checked both the table columns and data type ..Column name or number of supplied values does not match table definition.
I am getting error message on this video and the next one. Please help
Part 43:
CREATE TRIGGER tr_tblEmployeeTrigger_ForInsert
ON tblEmployeeTrigger
FOR INSERT
AS
BEGIN
Declare @ID int
Select @ID = ID from inserted
Insert Into tblEmployeeAuditTrigger
Values ('New employee with ID = ' + CAST(@ID as nvarchar(5)) + ' is added on ' + CAST(Getdate() as nvarchar(20)))
END
Error: Msg 213, Level 16, State 1, Procedure tr_tblEmployeeTrigger_ForInsert, Line 9
Column name or number of supplied values does not match table definition.
These videos are a life saver
Your all videos are really awesome and your explanation style is mind blowing !!!! Please carry on help us with the SQL SERVER and BI as well. Would be great help if you start with SSIS and all.
So nice video. I really like it. I joyed your video every night. I also tell my Students. Ask them learn if "you want to become a professional programmer". You are number one!!!
Thank you for awesome explanation, I want my son be like you means as knowledgable as you, now he's in 4th standard, will show your videos to him to know how to involve deeply in subject before presenting to audience, your mother is so lucky to had a great son. Happy Mothers day amma
Hi Kudvenkat,
Is there schedule or time events in MS SQL SERVER to achieve a feature like , to post newsletters and email at specific time set by user. MySql has this feature, I searched the web for sql server but cannot find this feature in sql server. Your help and suggestions will be highly appreciated.
link for MySql is here . http://www.sitepoint.com/working-with-mysql-events/
I'm sorry I meant:before/or/after update/or/delete/or/insert
I don't know, I'm confused here! probably the syntax you're using is old? to the best of my knowledge, syntax should be:create trigger Name_of_trigger before/or/after ON Name-Of_table for each row begin/code of what you want the trigger to do here/endplease advise.as this is also for the dml
Hello Venkat,
what is the data type of Auditdata. i am receiving errors while creating triggers, it shows message that the column name or number of supplied values does not match table definition.
Thank you so much Mr.Venkat. Your explanation is quite clear and I could understand once.
thank you very much
Sorry sir,but you can tell what is the data type of Auditdata.
because when i want to execute the trigger SQL show me error message that the column name or number of supplied values does not match table definition.
Thank you sir.
amazing social work..
hi venket !!
i have a question
what about if we inserted more than 1 row into table how to get thous data into a trigger can you ??
Hi Venkat
Thanks for these excellent videos. I learnt a lot so for. I wish you had videos for SSRS, SSIS and T-SQL.
In this video I create the following and get error. Could you please help me find the problem.
Create Trigger tr_tblPeople_ForDelete
On tblPeople
For Delete
As
Begin
Declare @DepartId int
Select @DepartId = DepartId from deleted
Insert into tblPeopleAudit
Values ('An existing employee with Id =' + cast(@DepartId as nvarchar(20)) , 'is deleted at' + CAST(Getdate() as nvarchar(30)))
End
insert into tblPeople values (6 ,'Sare', 3200, 'Female', 2)
when I insert or delete values I get this error
Msg 245, Level 16, State 1, Procedure tr_tblPeople_ForInsert, Line 10
Conversion failed when converting the nvarchar value 'The new employee with Id =6' to data type int.
Thanks for the videos venkat… am following all the videos and am looking for truncate command i could'nt find that please tell me reason is that command is not there in sql server 2005..
Wow your explanations are so easy to understand…. thank you so much for all your videos they are amazingly helpful. : ) !
Good job, your vids are complety helpful.
Thank you Venkat !
Thank you, my confusions were cleared in 17 mins :)
Nicely explain. I have one question.. Can we write one trigger for both Update and Delete??

Ur a perfect lecturer. Thanks for the good work 
Great video and excellent explanation. Thanks very much.
Can u plz tell me ,how to fire a trigger after certain  period of time(ex after 2months) ?
I needed a quick and clear answer on the topic of triggers,
and you delivered perfectly
Thanks!
man you are the best 
Great video and excellent explanation. Thanks very much for sharing.
Good video
BUT, pleaseÂ
SQLÂ
not CQL 
Thank you for the informative video! :D
Hi ,
What happens when theinsert statement has multiple rows ?@id=select id from inserted will not work as the query will return multiple rows .
How do we handle this situation ?
I've heard that triggers give slow performance
great tutor its easy with your help,,,,! thax 
+kudvenkat where can i download ready made database for exercising. Link please.,Thanks.
you are a life saver 🙂 much thanks !
My group and i have been watching your videos to help with our class project and it's been so much help. Thank you so much
create Trigger tr_employee_Forinsert
on employee
FOR INSERT
AS
BEGIN
      declare @Id int
      select @Id= Id from inserted
insert into employee2
values('New Employee Id =' + cast(@Id as varchar(5))+'is added at'Â
+CAST(GETDATE()as varchar(20)))
End
I have written this code but its showing error:
Msg 213, Level 16, State 1, Procedure tr_employee_Forinsert, Line 9
Column name or number of supplied values does not match table definition.
I am not able to understand please tell me what is the behind this error.
For some reason when I write the exact trigger as shown at 11:28 and run it I get the following error: "Msg 208, Level 16, State 6, Procedure tr_tblEmployee_ForInsert, Line 1
Invalid object name 'tr_tblEmployee_ForInsert'." Any idea what is gone wrong. I created identical tblEmployee and tblEmployeeAudit tables but it doesn't go through like in the video?