how to monitor table changes
From: Ray Higdon (rayhigdon_at_higdonconsulting.com)
Date: 08/08/03
- Next message: Bill R.: "MS03-031 & missing SQL performance counters"
- Previous message: Dejan Sarka: "Re: how to monitor table changes"
- In reply to: AJAY R: "how to monitor table changes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 8 Aug 2003 03:10:10 -0700
Simple example:
create table foo (ikey int identity(1,1), name varchar(20))
create table foo2 (ikey int identity(1,1),foo_int int,
name varchar(20))
Create trigger mytrigg on foo
for insert,update,delete
as
insert into foo2
select * from inserted
union all
select * from deleted
insert into foo select 'joe' union all select 'rob' union
all select 'joey'
update foo set name = 'harry' where name = 'rob'
delete from foo where ikey > 1
select * from foo2
HTH
Ray Higdon MCSE, MCDBA, CCNA
>-----Original Message-----
>Hi ,
>I want to monitor insert,update,delete on a particular
code through trigger
>, I am planning to create a another table as a logtable ,
I can achieve it
>for update & delete can anybody give me code to achieve
all
>insert,update&delete using signle trigger .
>
>Thanks & Regards
>Ajay
>
>
>.
>
- Next message: Bill R.: "MS03-031 & missing SQL performance counters"
- Previous message: Dejan Sarka: "Re: how to monitor table changes"
- In reply to: AJAY R: "how to monitor table changes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|