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 |
sr_aneesh
Starting Member
17 Posts |
Posted - 2005-01-31 : 06:41:53
|
i made a trigger to track the changes made to a record in a table.I want that whenever any record is updated (only when a record is updated) a new record should be added in to the table1I wrote the following Trigger but when ever i Click the Update Button even if i dont make any changes to the Record a new record is inserted in to the table1.CREATE TRIGGER Contrack_update ON maintable AFTER UPDATEASIF @@ROWCOUNT=0 RETURNINSERT table1 SELECT * FROM inserted I want that a new record should be insertted only if any changes is made to any record |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-31 : 07:44:12
|
you could use COLUMNS_UPDATED()look that up in BOL under Create Trigger example E.Go with the flow & have fun! Else fight the flow |
|
|
sr_aneesh
Starting Member
17 Posts |
Posted - 2005-01-31 : 07:53:39
|
what is BOL? |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-01-31 : 07:57:31
|
It's Books Online. It comes free with SQL Server. It should be your best friend if you are going to use SQL Server and actually understand the tool you're using. Start/All Programs/Microsoft SQL Server/Books Online.Sleep with it for a few days. Read it from front to back. You will be a better person for it. MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
|
|
|
|
|