RE: I'm not Trigger happy :-)

From: Mal .mullerjannie_at_hotmail.com> (.mullerjannie_at_hotmail.com)
Date: 11/01/04


Date: Mon, 1 Nov 2004 02:00:02 -0800

Why not use identity column or computer columns ?

"mekim" wrote:

> I am writing my first trigger in the example listed below ...and I'm getting
> lost in something...so thx for any assistance
>
> -I am trying to update a field called RecordVersion any time there is an
> update to the table
>
> -I realize that the code below is "wrong" ...but I don't see how u can pin
> point the row that is being updated from the trigger call
>
> -And I wonder what happens when this trigger fires the same trigger each
> time the update is called on "RecordVersion"
>
> Big TIA
>
> ALTER TRIGGER UpdateTrigger
> ON dbo.Table1
> FOR UPDATE
> AS
> UPDATE Table1 SET RecordVersion = RecordVersion + 1
>
>



Relevant Pages

  • Re: AFTER INSERT?
    ... If you have an identity column you can really reset the value from within a ... is there a After Insert trigger functionality in SQL Server 2000? ... > and reset it if it has passed a certain limit. ... > It appears that I cannot do this WHILE I am inserting, ...
    (microsoft.public.sqlserver.programming)
  • Re: trigger???
    ... If all you want is an ascending integer key, use an identity column. ... If not, you CAN use a 'before' trigger, called an 'instead of' trigger in ... create table MyTable (MyTableID int not null primary key, ...
    (microsoft.public.sqlserver.server)
  • Re: @@IDENTITY in SQL server
    ... sent through to the Execute statement of a connection object), ... guaranteed to get the identity column of the record that was just ... If the table into which you are inserting has a trigger that inserts data ...
    (microsoft.public.inetserver.asp.db)
  • insert trigger problem
    ... identity column as a primary key -> every time i add a value using my form i ... primary key and with using a trigger this variable gets changed. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Logon auditing through trigger on sysprocesses?
    ... The change logging part is working, with a simple trigger. ... The 'TestLog' table must exist before the trigger is added, ... In the real test I included an identity column, ...
    (microsoft.public.sqlserver.msde)