Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-04 : 00:58:37
|
Fredrik writes "Hola!
I have two tabels, table1 wich gets updated, tabel2 which I want to note which rows in tabel1 who gets changed.
So I need a trigger thats get fired when something happens in tabel1, and I need to return the primarykey from tabel1 on that row who gets change and store that value in tabel2.
So what I have tried is somthing like this:
Create trigger dbo.tr_change_on_tabel1 On table1 For { Insert | Delete | Update } With encryption as Declare id numeric Select @@identity Into id
insert into tabel2 (tabel, id) values('tabel1', id)
This last one would be great if it could be replaced by a stored_procedure as well.
It would be great if you could help me out with this.
Best regards
Fredrik" |
|
|
|
|
|