Getting records using the Triggers
hi to all,
i want get the updated records using the trigger. i am using the following query for that,
create trigger updatetrigger ON testtable for UPDATE AS BEGIN Declare @Name nvarchar(50)
Declare @age nvarchar(50)
Declare @mailid nvarchar(50)
Declare @phoenno nvarchar(50)
Declare @datetime smalldatetime SELECT @Name = Name , @age = age , @mailid = mailid , @phoenno = phoenno , @datetime = datetime FROM INSERTED
END
my table testtable does not contain unique field.
when i update the value in the testtable. the affected row is not stored in the testtable1. how can i solve the probems. plz help me . and also i need to get the records before updated . can i get the records using the update triggers. if anybody know plz help me.
thank u
with thanks and regards
mmary
Re: Getting records using the Triggers
I think you are storing the updated values into local variables inside the trigger and not doing anything with those variables afterwards. I think the following statement will return you the values you are looking for:
Select Name,age, mailid,phoneno,datetime from inserted
Then, if you want to get the old values you can get them inside the update trigger from the deleted table:
Select Name,age, mailid,phoneno,datetime from deleted
Re: Getting records using the Triggers
thank u . thank u very much for ur reply.
with thanks and regards
mmary