Results 1 to 3 of 3

Thread: using triggers in sql 2000 [Resolved]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    Resolved using triggers in sql 2000 [Resolved]

    Okay what I'd like to do is when a value is updated in one table I would like to add a value into another table

    Code:
    CREATE TRIGGER dbo.gmprospectdate
    ON contact1
    FOR UPDATE
    AS
    DECLARE @key1 varchar(255), @ACCOUNTNO varchar(20)
    
    SELECT @key1 = key1, @ACCOUNTNO=ACCOUNTNO
    FROM inserted 
    where key1 is not null
    
    case  @key1
    when 'Prospect' then update contact2 set uprospect = getdate() where ACCOUNTNO = @ACCOUNTNO
    when 'Trial' then update contact2 set UFCSDATE = getdate() where ACCOUNTNO = @ACCOUNTNO
    when 'Client' then update contact2 set USTARTDATE = getdate() where ACCOUNTNO = @ACCOUNTNO
    end
    This is what I've come up with and it obviuosly doesn't work, could you give me some pointers.
    Cheers all.
    Last edited by Oliver1; Jan 30th, 2007 at 11:20 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width