create trigger empdata_to_upd_empage on empdata
for update
as
if update (empid)
begin
update empage set empage.empid = inserted.empid
from
inserted,empage,deleted
where deleted.empid=empage.empid
end
(1 row affected)
(return status = 0)
1> select * from empdata
2>
empname empid
-------------------- -----------
k 654
m 76
o 6
t 98
w 65
(5 rows affected)
1> select * from empage
2>
empid empage
----------- -----------
654 23
76 45
6 43
98 29
65 60
(5 rows affected)
1> update empdata set empid=100 where empname='t'
2>
(1 row affected)
1> select * from empdata
2>
empname empid
-------------------- -----------
k 654
m 76
o 6
t 100
w 65
(5 rows affected)
1> select * from empage
2>
empid empage
----------- -----------
654 23
76 45
6 43
100 29
65 60
(5 rows affected)
1>
Friday, 15 January 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment