Monday, 12 February 2018

trigger for delete in sql server

create trigger Deletes
    on srudent
    for delete as begin declare
                 @id int,
                 @name nvarchar(30),
                 @gender nvarchar(7),
                 @age int
                 select @id= id ,@name=name,@gender = gender,@age=age from deleted
                 insert into backs values('New id is '+cast(@id as nvarchar(10))+' New name is '+@name+' New gender is '+@gender+' new age is '+cast(@age as nvarchar(10))+' Date is '+cast(getDate() as nvarchar(20)))
                   end
   

No comments:

Post a Comment