Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2011
    Posts
    15

    Red face Unanswered: Writing triggers in Sybase

    Can someone help me with the following info:

    1.Is there any before insert trigger supported for Sybase.
    2.How to write the trigger and sequence go hand in hand just like in oracle.
    3.Any idea on translating the following piece of oracle code to Sybase.sample_phones_id is a Oracle sequence here.

    CREATE TRIGGER sample_id
    BEFORE INSERT
    ON sample_phones
    FOR EACH ROW
    Declare rollNum number;
    BEGIN
    select sample_phones_id.nextval into rollNum from dual;
    :new.rollNum:=rollNum;
    END;

    Regards,
    Jeevana.

  2. #2
    Join Date
    Mar 2008
    Posts
    96
    It seems you are trying the auto increment thing here.
    It can be easily achieved in Sybase by using auto identity column without writing any trigger for more info refer Transact-SQL User's Guide

Tags for this Thread

Posting Permissions

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