sql server - Error in creating trigger -


i trying create trigger follows when got error message "msg 156, level 15, state 1, procedure defecttrigger, line 15 incorrect syntax near keyword 'set'."

the code below. can please let me know causing error.

use [dm] set ansi_nulls on go set quoted_identifier on go create  trigger defecttrigger on dbo.tcefed  insert          declare @defid int;        declare @clientid int;        declare @deflog varchar(200);        declare @datatime datetime;        declare @status varchar(50);        declare @project varchar(50);  select @clientid=i.clientid inserted i;     select @defid=i.defectid inserted i;    select @project=i.projectcode inserted i,  set @defid = 'insert dbo.defectlog values(@clientid,@project,@defid)'   go 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -