Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    1

    Unanswered: Row level trigger

    Hi all

    I am doing a DB porting project in which i need to translate oracle specific queries to sql server.I need to convert following trigger to sqlserver specific .Any help will be appreciated

    Code:
    CREATE OR REPLACE TRIGGER T_BI_R_TARGET_OBJECTIVE
    BEFORE INSERT
    ON TARGET_OBJECTIVE
    REFERENCING OLD AS OLD NEW AS NEW
    FOR EACH ROW WHEN (NEW.TARGET_OBJECTIVE_ID IN (NULL,0))
    DECLARE
            seq_id  NUMBER;
    BEGIN
            SELECT TARGET_OBJECTIVE_ID_SEQ.NEXTVAL INTO seq_id FROM dual;
            :new.TARGET_OBJECTIVE_ID := seq_id;
    END;
    Regards
    sreenath

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    First of all read thru SQL books online for TRIGGERS topic which explains the information on SQL Server.

    HTH
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

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